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
Этот коммит содержится в:
родитель
a24aee417d
Коммит
717e697e0b
@ -1,5 +1,6 @@
|
|||||||
2016-02-28 Benno Schulenberg <bensberg@justemail.net>
|
2016-02-28 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/nano.h, src/rcfile.c, src/color.c: Rename a struct member.
|
* 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>
|
2016-02-28 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/rcfile.c (parse_header_exp): Don't continue when something is
|
* src/rcfile.c (parse_header_exp): Don't continue when something is
|
||||||
|
18
src/rcfile.c
18
src/rcfile.c
@ -286,14 +286,17 @@ void parse_syntax(char *ptr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr++;
|
nameptr = ++ptr;
|
||||||
|
|
||||||
nameptr = ptr;
|
|
||||||
ptr = parse_next_regex(ptr);
|
ptr = parse_next_regex(ptr);
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return;
|
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
|
/* Search for a duplicate syntax name. If we find one, free it, so
|
||||||
* that we always use the last syntax with a given name. */
|
* that we always use the last syntax with a given name. */
|
||||||
prev_syntax = NULL;
|
prev_syntax = NULL;
|
||||||
@ -346,13 +349,6 @@ void parse_syntax(char *ptr)
|
|||||||
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
|
fprintf(stderr, "Starting a new syntax type: \"%s\"\n", nameptr);
|
||||||
#endif
|
#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. */
|
/* The default syntax should have no associated extensions. */
|
||||||
if (strcmp(endsyntax->name, "default") == 0 && *ptr != '\0') {
|
if (strcmp(endsyntax->name, "default") == 0 && *ptr != '\0') {
|
||||||
rcfile_error(
|
rcfile_error(
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user