+2016-03-01 Benno Schulenberg <bensberg@justemail.net>
+ * src/rcfile.c (parse_syntax), src/color.c (color_update): Don't
+ bother discarding a duplicate syntax (it's too rare, saves little
+ memory, and freeing it properly would cost even more code), just
+ select the last-defined one. This addresses Savannah bug #47303.
+
2016-02-29 Benno Schulenberg <bensberg@justemail.net>
* src/nano.h, src/rcfile.c, src/color.c: Rename a struct member.
* src/rcfile.c (parse_rcfile): Don't allocate a struct for the "none"
openfile->syntax = sint;
openfile->colorstrings = sint->color;
}
-
- if (openfile->colorstrings != NULL)
- break;
}
if (openfile->colorstrings == NULL)
if (strcmp(sint->name, "default") == 0) {
openfile->syntax = sint;
openfile->colorstrings = sint->color;
- break;
}
}
}
void parse_syntax(char *ptr)
{
const char *fileregptr = NULL, *nameptr = NULL;
- syntaxtype *tmpsyntax, *prev_syntax;
regexlisttype *endext = NULL;
/* The end of the extensions list for this syntax. */
return;
}
- /* Search for a duplicate syntax name. If we find one, free it, so
- * that we always use the last syntax with a given name. */
- prev_syntax = NULL;
- for (tmpsyntax = syntaxes; tmpsyntax != NULL;
- tmpsyntax = tmpsyntax->next) {
- if (strcmp(nameptr, tmpsyntax->name) == 0) {
- syntaxtype *old_syntax = tmpsyntax;
-
- if (endsyntax == tmpsyntax)
- endsyntax = prev_syntax;
-
- tmpsyntax = tmpsyntax->next;
- if (prev_syntax != NULL)
- prev_syntax->next = tmpsyntax;
- else
- syntaxes = tmpsyntax;
-
- free(old_syntax->name);
- free(old_syntax);
- break;
- }
- prev_syntax = tmpsyntax;
- }
-
if (syntaxes == NULL) {
syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype));
endsyntax = syntaxes;