From f72e16502e10ee8a7f04aecbddc2fbc066d56a9f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 12 Mar 2016 10:21:02 +0000 Subject: [PATCH] Renaming a variable. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5728 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + src/rcfile.c | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7d01e1a..67fc84ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ * src/rcfile.c (parse_one_include, parse_includes): New names for these functions, to be more distinguishable. * src/rcfile.c (parse_colors): Reduce the indentation. + * src/rcfile.c (parse_colors): Rename a variable. 2016-03-11 Benno Schulenberg * src/browser.c (do_browser): Fix compilation when configured with diff --git a/src/rcfile.c b/src/rcfile.c index 4e433865..e1f1a27e 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -658,10 +658,10 @@ void parse_colors(char *ptr, bool icase) while (ptr != NULL && *ptr != '\0') { colortype *newcolor; /* The container for a color plus its regexes. */ - bool cancelled = FALSE; - /* The start expression was bad. */ + bool goodstart; + /* Whether the start expression was valid. */ bool expectend = FALSE; - /* Do we expect an end= line? */ + /* Whether to expect an end= line. */ if (strncasecmp(ptr, "start=", 6) == 0) { ptr += 6; @@ -680,9 +680,11 @@ void parse_colors(char *ptr, bool icase) if (ptr == NULL) break; - /* Save the starting regex string if it's valid, and set up the - * color information. */ - if (nregcomp(fgstr, icase ? REG_ICASE : 0)) { + goodstart = nregcomp(fgstr, icase ? REG_ICASE : 0); + + /* If the starting regex is valid, initialize a new color struct, + * and hook it in at the tail of the linked list. */ + if (goodstart) { newcolor = (colortype *)nmalloc(sizeof(colortype)); newcolor->fg = fg; @@ -698,15 +700,12 @@ void parse_colors(char *ptr, bool icase) newcolor->next = NULL; - if (endcolor == NULL) { +#ifdef DEBUG + fprintf(stderr, "Adding an entry for fg %hd, bg %hd\n", fg, bg); +#endif + if (endcolor == NULL) live_syntax->color = newcolor; -#ifdef DEBUG - fprintf(stderr, "Starting a new colorstring for fg %hd, bg %hd\n", fg, bg); -#endif - } else { -#ifdef DEBUG - fprintf(stderr, "Adding new entry for fg %hd, bg %hd\n", fg, bg); -#endif + else { /* Need to recompute endcolor now so we can extend * colors to syntaxes. */ for (endcolor = live_syntax->color; endcolor->next != NULL;) @@ -715,8 +714,7 @@ void parse_colors(char *ptr, bool icase) } endcolor = newcolor; - } else - cancelled = TRUE; + } if (!expectend) continue; @@ -739,7 +737,7 @@ void parse_colors(char *ptr, bool icase) /* If the start regex was invalid, skip past the end regex * to stay in sync. */ - if (cancelled) + if (!goodstart) continue; /* If it's valid, save the ending regex string. */