Renaming a variable.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5728 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-03-12 10:21:02 +00:00
parent fa82824a59
commit f72e16502e
2 changed files with 16 additions and 17 deletions

View File

@ -4,6 +4,7 @@
* src/rcfile.c (parse_one_include, parse_includes): New names for * src/rcfile.c (parse_one_include, parse_includes): New names for
these functions, to be more distinguishable. these functions, to be more distinguishable.
* src/rcfile.c (parse_colors): Reduce the indentation. * src/rcfile.c (parse_colors): Reduce the indentation.
* src/rcfile.c (parse_colors): Rename a variable.
2016-03-11 Benno Schulenberg <bensberg@justemail.net> 2016-03-11 Benno Schulenberg <bensberg@justemail.net>
* src/browser.c (do_browser): Fix compilation when configured with * src/browser.c (do_browser): Fix compilation when configured with

View File

@ -658,10 +658,10 @@ void parse_colors(char *ptr, bool icase)
while (ptr != NULL && *ptr != '\0') { while (ptr != NULL && *ptr != '\0') {
colortype *newcolor; colortype *newcolor;
/* The container for a color plus its regexes. */ /* The container for a color plus its regexes. */
bool cancelled = FALSE; bool goodstart;
/* The start expression was bad. */ /* Whether the start expression was valid. */
bool expectend = FALSE; bool expectend = FALSE;
/* Do we expect an end= line? */ /* Whether to expect an end= line. */
if (strncasecmp(ptr, "start=", 6) == 0) { if (strncasecmp(ptr, "start=", 6) == 0) {
ptr += 6; ptr += 6;
@ -680,9 +680,11 @@ void parse_colors(char *ptr, bool icase)
if (ptr == NULL) if (ptr == NULL)
break; break;
/* Save the starting regex string if it's valid, and set up the goodstart = nregcomp(fgstr, icase ? REG_ICASE : 0);
* color information. */
if (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 = (colortype *)nmalloc(sizeof(colortype));
newcolor->fg = fg; newcolor->fg = fg;
@ -698,15 +700,12 @@ void parse_colors(char *ptr, bool icase)
newcolor->next = NULL; 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; live_syntax->color = newcolor;
#ifdef DEBUG else {
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
/* Need to recompute endcolor now so we can extend /* Need to recompute endcolor now so we can extend
* colors to syntaxes. */ * colors to syntaxes. */
for (endcolor = live_syntax->color; endcolor->next != NULL;) for (endcolor = live_syntax->color; endcolor->next != NULL;)
@ -715,8 +714,7 @@ void parse_colors(char *ptr, bool icase)
} }
endcolor = newcolor; endcolor = newcolor;
} else }
cancelled = TRUE;
if (!expectend) if (!expectend)
continue; continue;
@ -739,7 +737,7 @@ void parse_colors(char *ptr, bool icase)
/* If the start regex was invalid, skip past the end regex /* If the start regex was invalid, skip past the end regex
* to stay in sync. */ * to stay in sync. */
if (cancelled) if (!goodstart)
continue; continue;
/* If it's valid, save the ending regex string. */ /* If it's valid, save the ending regex string. */