Reducing the indentation by short-circuiting a loop.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5727 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
3cb80ff7ea
Коммит
fa82824a59
@ -3,6 +3,7 @@
|
|||||||
just once, in a single place. And unnest two 'if's.
|
just once, in a single place. And unnest two 'if's.
|
||||||
* 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.
|
||||||
|
|
||||||
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
|
||||||
|
58
src/rcfile.c
58
src/rcfile.c
@ -718,37 +718,37 @@ void parse_colors(char *ptr, bool icase)
|
|||||||
} else
|
} else
|
||||||
cancelled = TRUE;
|
cancelled = TRUE;
|
||||||
|
|
||||||
if (expectend) {
|
if (!expectend)
|
||||||
if (ptr == NULL || strncasecmp(ptr, "end=", 4) != 0) {
|
continue;
|
||||||
rcfile_error(
|
|
||||||
N_("\"start=\" requires a corresponding \"end=\""));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ptr += 4;
|
|
||||||
if (*ptr != '"') {
|
|
||||||
rcfile_error(
|
|
||||||
N_("Regex strings must begin and end with a \" character"));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
fgstr = ++ptr;
|
if (ptr == NULL || strncasecmp(ptr, "end=", 4) != 0) {
|
||||||
ptr = parse_next_regex(ptr);
|
rcfile_error(N_("\"start=\" requires a corresponding \"end=\""));
|
||||||
if (ptr == NULL)
|
return;
|
||||||
break;
|
|
||||||
|
|
||||||
/* If the start regex was invalid, skip past the end regex
|
|
||||||
* to stay in sync. */
|
|
||||||
if (cancelled)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* If it's valid, save the ending regex string. */
|
|
||||||
if (nregcomp(fgstr, icase ? REG_ICASE : 0))
|
|
||||||
newcolor->end_regex = mallocstrcpy(NULL, fgstr);
|
|
||||||
|
|
||||||
/* Lame way to skip another static counter. */
|
|
||||||
newcolor->id = live_syntax->nmultis;
|
|
||||||
live_syntax->nmultis++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ptr += 4;
|
||||||
|
if (*ptr != '"') {
|
||||||
|
rcfile_error(N_("Regex strings must begin and end with a \" character"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
fgstr = ++ptr;
|
||||||
|
ptr = parse_next_regex(ptr);
|
||||||
|
if (ptr == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* If the start regex was invalid, skip past the end regex
|
||||||
|
* to stay in sync. */
|
||||||
|
if (cancelled)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* If it's valid, save the ending regex string. */
|
||||||
|
if (nregcomp(fgstr, icase ? REG_ICASE : 0))
|
||||||
|
newcolor->end_regex = mallocstrcpy(NULL, fgstr);
|
||||||
|
|
||||||
|
/* Lame way to skip another static counter. */
|
||||||
|
newcolor->id = live_syntax->nmultis;
|
||||||
|
live_syntax->nmultis++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user