From 3d6378b1537e436b4d205931e3cf89944c66e02c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 1 Dec 2015 12:35:48 +0000 Subject: [PATCH] Moving a check to a better place. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5461 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + src/winio.c | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3d44b671..e8ff7e00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ actually something was inserted. This fixes Savannah bug #45409. * src/files.c (do_insertfile): Rename two variables for clarity. * src/text.c (redo_cut): Delete two redundant assignments. + * src/winio.c (edit_draw): Move a check to a better place. 2015-11-30 Benno Schulenberg * src/text.c (redo_cut, update_undo): When cutting reaches the EOF, diff --git a/src/winio.c b/src/winio.c index e83c353d..0aa56713 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2596,20 +2596,21 @@ void edit_draw(filestruct *fileptr, const char *converted, int start_line = start_line->prev; } + /* If no start was found, skip to the next step. */ + if (start_line == NULL) + goto step_two; + /* If a found start has been qualified as an end earlier, * believe it and skip to the next step. */ - if (start_line != NULL && start_line->multidata != NULL && + if (start_line->multidata != NULL && (start_line->multidata[tmpcolor->id] == CBEGINBEFORE || start_line->multidata[tmpcolor->id] == CSTARTENDHERE)) goto step_two; /* Skip over a zero-length regex match. */ - if (start_line != NULL && startmatch.rm_so == startmatch.rm_eo) + if (startmatch.rm_so == startmatch.rm_eo) startmatch.rm_eo++; else { - /* If no start was found, skip to the next step. */ - if (start_line == NULL) - goto step_two; /* Now start_line is the first line before fileptr * containing a start match. Is there a start on * this line not followed by an end on this line? */