Rearranging a few things in my style.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5695 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
07f71e6c1a
commit
68d94a0c74
|
@ -7,6 +7,7 @@
|
||||||
* 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
|
* src/rcfile.c (grab_and_store): Do not drop regexes that were
|
||||||
gathered earlier. This fixes Savannah bug #47285.
|
gathered earlier. This fixes Savannah bug #47285.
|
||||||
|
* src/rcfile.c (grab_and_store): Rearrange things in my style.
|
||||||
|
|
||||||
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,
|
||||||
|
|
28
src/rcfile.c
28
src/rcfile.c
|
@ -879,7 +879,7 @@ void grab_and_store(char *ptr, const char *kind, regexlisttype **storage)
|
||||||
while (lastthing != NULL && lastthing->next != NULL)
|
while (lastthing != NULL && lastthing->next != NULL)
|
||||||
lastthing = lastthing->next;
|
lastthing = lastthing->next;
|
||||||
|
|
||||||
/* Now load the regexes into their part of the struct. */
|
/* Now gather any valid regexes and add them to the linked list. */
|
||||||
while (*ptr != '\0') {
|
while (*ptr != '\0') {
|
||||||
const char *regexstring;
|
const char *regexstring;
|
||||||
regexlisttype *newthing;
|
regexlisttype *newthing;
|
||||||
|
@ -895,22 +895,22 @@ void grab_and_store(char *ptr, const char *kind, regexlisttype **storage)
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* If the regex string is malformed, skip it. */
|
||||||
|
if (nregcomp(regexstring, REG_NOSUB) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Copy the regex into a struct, and hook this in at the end. */
|
||||||
newthing = (regexlisttype *)nmalloc(sizeof(regexlisttype));
|
newthing = (regexlisttype *)nmalloc(sizeof(regexlisttype));
|
||||||
|
newthing->full_regex = mallocstrcpy(NULL, regexstring);
|
||||||
|
newthing->rgx = NULL;
|
||||||
|
newthing->next = NULL;
|
||||||
|
|
||||||
/* Save the regex string if it's valid. */
|
if (lastthing == NULL)
|
||||||
if (nregcomp(regexstring, REG_NOSUB)) {
|
*storage = newthing;
|
||||||
newthing->full_regex = mallocstrcpy(NULL, regexstring);
|
else
|
||||||
newthing->rgx = NULL;
|
lastthing->next = newthing;
|
||||||
|
|
||||||
if (lastthing == NULL)
|
lastthing = newthing;
|
||||||
*storage = newthing;
|
|
||||||
else
|
|
||||||
lastthing->next = newthing;
|
|
||||||
|
|
||||||
lastthing = newthing;
|
|
||||||
lastthing->next = NULL;
|
|
||||||
} else
|
|
||||||
free(newthing);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue