Commit c879f556 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

in parse_syntax(), flag duplicate syntax names as errors

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2952 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
parent 6135bf3f
Showing with 19 additions and 10 deletions
+19 -10
...@@ -57,16 +57,16 @@ CVS code - ...@@ -57,16 +57,16 @@ CVS code -
thanks_for_all_the_fish(), nregcomp(), parse_syntax(), and thanks_for_all_the_fish(), nregcomp(), parse_syntax(), and
parse_colors(). (Brand Huntsman and DLR) parse_colors(). (Brand Huntsman and DLR)
- Various other color fixes. Handle unspecified foreground - Various other color fixes. Handle unspecified foreground
colors properly, don't automatically reinitialize the colors properly, flag duplicate syntax names as errors, don't
displayed colors every time we update the current buffer's automatically reinitialize the displayed colors every time we
colors (since the buffer may not be displayed immediately), update the current buffer's colors (since the buffer may not
don't bother doing complete refreshes of the screen when be displayed immediately), don't bother doing complete
color support is enabled if there's no regex associated with refreshes of the screen when color support is enabled if
the current file, and rename variable exttype->val to there's no regex associated with the current file, and rename
exttype->ext, for consistency. Changes to do_colorinit() variable exttype->val to exttype->ext, for consistency.
(renamed color_init()), update_color() (renamed Changes to do_colorinit() (renamed color_init()),
color_update()), write_file(), do_input(), do_output(), and update_color() (renamed color_update()), write_file(),
parse_syntax(). (DLR) do_input(), do_output(), and parse_syntax(). (DLR)
- Simplify get_totals() to only get the total number of - Simplify get_totals() to only get the total number of
characters, and eliminate dependence on its old ability to get characters, and eliminate dependence on its old ability to get
the total number of lines by renumber()ing when necessary and the total number of lines by renumber()ing when necessary and
......
...@@ -268,6 +268,7 @@ bool nregcomp(const char *regex, int eflags) ...@@ -268,6 +268,7 @@ bool nregcomp(const char *regex, int eflags)
void parse_syntax(char *ptr) void parse_syntax(char *ptr)
{ {
const char *fileregptr = NULL, *nameptr = NULL; const char *fileregptr = NULL, *nameptr = NULL;
const syntaxtype *tmpsyntax;
exttype *endext = NULL; exttype *endext = NULL;
/* The end of the extensions list for this syntax. */ /* The end of the extensions list for this syntax. */
...@@ -292,6 +293,14 @@ void parse_syntax(char *ptr) ...@@ -292,6 +293,14 @@ void parse_syntax(char *ptr)
if (ptr == NULL) if (ptr == NULL)
return; return;
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
tmpsyntax = tmpsyntax->next) {
if (mbstrcasecmp(nameptr, tmpsyntax->desc) == 0) {
rcfile_error(N_("Duplicate syntax name %s"), nameptr);
return;
}
}
if (syntaxes == NULL) { if (syntaxes == NULL) {
syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype)); syntaxes = (syntaxtype *)nmalloc(sizeof(syntaxtype));
endsyntax = syntaxes; endsyntax = syntaxes;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment