mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-21 20:31:20 +03:00
Renaming another struct element, because it refers not just
to file extensions, but also to header lines and magic strings. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5690 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
3522751c6b
commit
07441adb14
@ -9,6 +9,8 @@
|
||||
* src/color.c (color_update): Rename a variable for conciseness.
|
||||
* src/color.c (nfreeregex): Elide this function, now used just once.
|
||||
* src/nano.h: Rename a struct element for aptness and contrast.
|
||||
* src/nano.h: Rename another element, because it refers not just
|
||||
to file extensions, but also to header lines and magic strings.
|
||||
|
||||
GNU nano 2.5.3 - 2016.02.25
|
||||
|
||||
|
14
src/color.c
14
src/color.c
@ -147,20 +147,20 @@ bool found_in_list(regexlisttype *head, const char *shibboleth)
|
||||
bool not_compiled;
|
||||
|
||||
for (item = head; item != NULL; item = item->next) {
|
||||
not_compiled = (item->ext == NULL);
|
||||
not_compiled = (item->rgx == NULL);
|
||||
|
||||
if (not_compiled) {
|
||||
item->ext = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(item->ext, fixbounds(item->full_regex), REG_EXTENDED);
|
||||
item->rgx = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(item->rgx, fixbounds(item->full_regex), REG_EXTENDED);
|
||||
}
|
||||
|
||||
if (regexec(item->ext, shibboleth, 0, NULL, 0) == 0)
|
||||
if (regexec(item->rgx, shibboleth, 0, NULL, 0) == 0)
|
||||
return TRUE;
|
||||
|
||||
if (not_compiled) {
|
||||
regfree(item->ext);
|
||||
free(item->ext);
|
||||
item->ext = NULL;
|
||||
regfree(item->rgx);
|
||||
free(item->rgx);
|
||||
item->rgx = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1627,9 +1627,9 @@ int strtomenu(const char *input)
|
||||
void free_list_item(regexlisttype *dropit)
|
||||
{
|
||||
free(dropit->full_regex);
|
||||
if (dropit->ext != NULL)
|
||||
regfree(dropit->ext);
|
||||
free(dropit->ext);
|
||||
if (dropit->rgx != NULL)
|
||||
regfree(dropit->rgx);
|
||||
free(dropit->rgx);
|
||||
free(dropit);
|
||||
}
|
||||
#endif
|
||||
|
@ -231,10 +231,10 @@ typedef struct colortype {
|
||||
typedef struct regexlisttype {
|
||||
char *full_regex;
|
||||
/* A regex string to match things that imply a certain syntax. */
|
||||
regex_t *ext;
|
||||
/* The compiled regexes. */
|
||||
regex_t *rgx;
|
||||
/* The compiled regex. */
|
||||
struct regexlisttype *next;
|
||||
/* Next set of regexes. */
|
||||
/* The next regex. */
|
||||
} regexlisttype;
|
||||
|
||||
typedef struct syntaxtype {
|
||||
|
@ -375,7 +375,7 @@ void parse_syntax(char *ptr)
|
||||
/* Save the extension regex if it's valid. */
|
||||
if (nregcomp(fileregptr, REG_NOSUB)) {
|
||||
newext->full_regex = mallocstrcpy(NULL, fileregptr);
|
||||
newext->ext = NULL;
|
||||
newext->rgx = NULL;
|
||||
|
||||
if (endext == NULL)
|
||||
endsyntax->extensions = newext;
|
||||
@ -896,7 +896,7 @@ void parse_header_exp(char *ptr)
|
||||
/* Save the regex string if it's valid. */
|
||||
if (nregcomp(regexstring, 0)) {
|
||||
newheader->full_regex = mallocstrcpy(NULL, regexstring);
|
||||
newheader->ext = NULL;
|
||||
newheader->rgx = NULL;
|
||||
|
||||
if (endheader == NULL)
|
||||
endsyntax->headers = newheader;
|
||||
@ -961,7 +961,7 @@ void parse_magic_exp(char *ptr)
|
||||
/* Save the regex string if it's valid. */
|
||||
if (nregcomp(regexstring, REG_NOSUB)) {
|
||||
newmagic->full_regex = mallocstrcpy(NULL, regexstring);
|
||||
newmagic->ext = NULL;
|
||||
newmagic->rgx = NULL;
|
||||
|
||||
if (endmagic == NULL)
|
||||
endsyntax->magics = newmagic;
|
||||
|
Loading…
Reference in New Issue
Block a user