* 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 <bensberg@justemail.net>
* src/browser.c (do_browser): Fix compilation when configured with
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;
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;
newcolor->next = NULL;
- 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);
+ fprintf(stderr, "Adding an entry for fg %hd, bg %hd\n", fg, bg);
#endif
+ if (endcolor == NULL)
+ live_syntax->color = newcolor;
+ else {
/* Need to recompute endcolor now so we can extend
* colors to syntaxes. */
for (endcolor = live_syntax->color; endcolor->next != NULL;)
}
endcolor = newcolor;
- } else
- cancelled = TRUE;
+ }
if (!expectend)
continue;
/* 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. */