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
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;
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(