Using the grab_and_store() function also for gathering up extension regexes.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5712 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
b0bdfbb0f7
commit
2f63e8dfc1
|
@ -1,6 +1,8 @@
|
||||||
2016-03-09 Benno Schulenberg <bensberg@justemail.net>
|
2016-03-09 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/rcfile.c (parse_syntax): Produce an adequate error message
|
* src/rcfile.c (parse_syntax): Produce an adequate error message
|
||||||
when the syntax name is unquoted. This fixes Savannah bug #47324.
|
when the syntax name is unquoted. This fixes Savannah bug #47324.
|
||||||
|
* src/rcfile.c (parse_syntax): Use the grab_and_store() function
|
||||||
|
also for gathering up extension regexes.
|
||||||
|
|
||||||
2016-03-04 Benno Schulenberg <bensberg@justemail.net>
|
2016-03-04 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/color.c (found_in_list): Don't bother keeping the compiled
|
* src/color.c (found_in_list): Don't bother keeping the compiled
|
||||||
|
|
|
@ -567,6 +567,7 @@ void parse_include(char *ptr);
|
||||||
short color_to_short(const char *colorname, bool *bright);
|
short color_to_short(const char *colorname, bool *bright);
|
||||||
void parse_colors(char *ptr, bool icase);
|
void parse_colors(char *ptr, bool icase);
|
||||||
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
|
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
|
||||||
|
void grab_and_store(char *ptr, const char *kind, regexlisttype **storage);
|
||||||
#endif
|
#endif
|
||||||
void parse_rcfile(FILE *rcstream
|
void parse_rcfile(FILE *rcstream
|
||||||
#ifndef DISABLE_COLOR
|
#ifndef DISABLE_COLOR
|
||||||
|
|
41
src/rcfile.c
41
src/rcfile.c
|
@ -266,9 +266,8 @@ bool nregcomp(const char *regex, int eflags)
|
||||||
* global list of color syntaxes. */
|
* global list of color syntaxes. */
|
||||||
void parse_syntax(char *ptr)
|
void parse_syntax(char *ptr)
|
||||||
{
|
{
|
||||||
char *fileregptr, *nameptr;
|
char *nameptr;
|
||||||
regexlisttype *endext = NULL;
|
/* A pointer to what should be the name of the syntax. */
|
||||||
/* The end of the extensions list for this syntax. */
|
|
||||||
|
|
||||||
opensyntax = FALSE;
|
opensyntax = FALSE;
|
||||||
|
|
||||||
|
@ -334,38 +333,9 @@ void parse_syntax(char *ptr)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now load the extension regexes into their part of the struct. */
|
/* If there seem to be extension regexes, pick them up. */
|
||||||
while (*ptr != '\0') {
|
if (*ptr != '\0')
|
||||||
regexlisttype *newext;
|
grab_and_store(ptr, "extension", &endsyntax->extensions);
|
||||||
|
|
||||||
while (*ptr != '"' && *ptr != '\0')
|
|
||||||
ptr++;
|
|
||||||
|
|
||||||
if (*ptr == '\0')
|
|
||||||
return;
|
|
||||||
|
|
||||||
ptr++;
|
|
||||||
|
|
||||||
fileregptr = ptr;
|
|
||||||
ptr = parse_next_regex(ptr);
|
|
||||||
if (ptr == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
newext = (regexlisttype *)nmalloc(sizeof(regexlisttype));
|
|
||||||
|
|
||||||
/* Save the extension regex if it's valid. */
|
|
||||||
if (nregcomp(fileregptr, REG_NOSUB)) {
|
|
||||||
newext->full_regex = mallocstrcpy(NULL, fileregptr);
|
|
||||||
|
|
||||||
if (endext == NULL)
|
|
||||||
endsyntax->extensions = newext;
|
|
||||||
else
|
|
||||||
endext->next = newext;
|
|
||||||
endext = newext;
|
|
||||||
endext->next = NULL;
|
|
||||||
} else
|
|
||||||
free(newext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* !DISABLE_COLOR */
|
#endif /* !DISABLE_COLOR */
|
||||||
|
|
||||||
|
@ -829,7 +799,6 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Read regex strings enclosed in double quotes from the line pointed at
|
/* Read regex strings enclosed in double quotes from the line pointed at
|
||||||
* by ptr, and store them quoteless in the passed storage place. */
|
* by ptr, and store them quoteless in the passed storage place. */
|
||||||
void grab_and_store(char *ptr, const char *kind, regexlisttype **storage)
|
void grab_and_store(char *ptr, const char *kind, regexlisttype **storage)
|
||||||
|
|
Loading…
Reference in New Issue