Not allocating a struct for the "none" syntax -- it doesn't need any.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5698 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2016-02-29 10:29:52 +00:00
parent a24aee417d
commit 717e697e0b
2 changed files with 8 additions and 11 deletions

View File

@ -1,5 +1,6 @@
2016-02-28 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 struct for none syntax.
2016-02-28 Benno Schulenberg <bensberg@justemail.net>
* src/rcfile.c (parse_header_exp): Don't continue when something is

View File

@ -286,14 +286,17 @@ void parse_syntax(char *ptr)
return;
}
ptr++;
nameptr = ptr;
nameptr = ++ptr;
ptr = parse_next_regex(ptr);
if (ptr == NULL)
return;
/* Redefining the "none" syntax is not allowed. */
if (strcmp(nameptr, "none") == 0) {
rcfile_error(N_("The \"none\" syntax is reserved"));
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;
@ -346,13 +349,6 @@ void parse_syntax(char *ptr)
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
#endif
/* The "none" syntax is the same as not having a syntax at all, so
* we can't assign any extensions or colors to it. */
if (strcmp(endsyntax->name, "none") == 0) {
rcfile_error(N_("The \"none\" syntax is reserved"));
return;
}
/* The default syntax should have no associated extensions. */
if (strcmp(endsyntax->name, "default") == 0 && *ptr != '\0') {
rcfile_error(