Not dropping regexes that were gathered earlier.

This fixes Savannah bug #47285.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5694 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2016-02-28 16:36:23 +00:00
parent c2148cc902
commit 07f71e6c1a
2 changed files with 9 additions and 1 deletions

View File

@ -5,6 +5,8 @@
Use the now correct parsing of header regexes also for parsing magic Use the now correct parsing of header regexes also for parsing magic
regexes. This fixes Savannah bug #47292 and saves 50 lines of code. regexes. This fixes Savannah bug #47292 and saves 50 lines of code.
* src/rcfile.c (grab_and_store): Rename a variable and densify. * src/rcfile.c (grab_and_store): Rename a variable and densify.
* src/rcfile.c (grab_and_store): Do not drop regexes that were
gathered earlier. This fixes Savannah bug #47285.
2016-02-26 Benno Schulenberg <bensberg@justemail.net> 2016-02-26 Benno Schulenberg <bensberg@justemail.net>
* doc/man/nanorc.5, doc/texinfo/nano.texi, doc/syntax/nanorc.nanorc, * doc/man/nanorc.5, doc/texinfo/nano.texi, doc/syntax/nanorc.nanorc,

View File

@ -860,7 +860,7 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
* 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)
{ {
regexlisttype *lastthing = NULL; regexlisttype *lastthing;
if (syntaxes == NULL) { if (syntaxes == NULL) {
rcfile_error( rcfile_error(
@ -873,6 +873,12 @@ void grab_and_store(char *ptr, const char *kind, regexlisttype **storage)
return; return;
} }
lastthing = *storage;
/* If there was an earlier command, go to the last of those regexes. */
while (lastthing != NULL && lastthing->next != NULL)
lastthing = lastthing->next;
/* Now load the regexes into their part of the struct. */ /* Now load the regexes into their part of the struct. */
while (*ptr != '\0') { while (*ptr != '\0') {
const char *regexstring; const char *regexstring;