From: Benno Schulenberg Date: Wed, 25 Nov 2015 09:49:27 +0000 (+0000) Subject: Eliding an unneeded variable, and not skipping the end of the function X-Git-Tag: v2.5.0~42 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b255b01b5054e65e40fde87e634ff4a5d5604e61;p=nano.git Eliding an unneeded variable, and not skipping the end of the function when things went wrong. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5441 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 4907cf51..493ce6a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ every keystroke in a burst, but just once. * src/text.c (do_undo): Warn about a condition that should never occur, instead of silently continuing. + * src/text.c (do_undo): Elide an unneeded variable, and don't skip + the end of this function when things went wrong. 2015-11-24 Benno Schulenberg * doc/syntax/makefile.nanorc: Also recognize the extensions .make and diff --git a/src/text.c b/src/text.c index fe6910ed..fb863149 100644 --- a/src/text.c +++ b/src/text.c @@ -563,18 +563,17 @@ void do_undo(void) f = fsfromline(u->lineno); break; case ENTER: - undidmsg = _("line break"); - filestruct *snipit = f->next; - if (snipit == NULL) { + if (f->next == NULL) { statusbar(_("Internal error: line is missing. Please save your work.")); - return; + break; } + undidmsg = _("line break"); f->data = charealloc(f->data, strlen(f->data) + strlen(&f->next->data[u->mark_begin_x]) + 1); strcat(f->data, &f->next->data[u->mark_begin_x]); - if (openfile->filebot == snipit) + if (openfile->filebot == f->next) openfile->filebot = f; - unlink_node(snipit); + unlink_node(f->next); goto_line_posx(u->lineno, u->begin); break; case INSERT: