From: Benno Schulenberg Date: Fri, 26 Feb 2016 20:19:13 +0000 (+0000) Subject: Renaming another struct element, because it refers not just X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=07441adb1483291412d1dd85a9213e98fb308c3f;p=nano.git 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 --- diff --git a/ChangeLog b/ChangeLog index c65439c6..17244711 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/color.c b/src/color.c index f1f6a351..eea26e16 100644 --- a/src/color.c +++ b/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; } } diff --git a/src/global.c b/src/global.c index f31c2e3d..8303d4fc 100644 --- a/src/global.c +++ b/src/global.c @@ -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 diff --git a/src/nano.h b/src/nano.h index 034cd13b..5f8eeb4d 100644 --- a/src/nano.h +++ b/src/nano.h @@ -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 { diff --git a/src/rcfile.c b/src/rcfile.c index 1b4d19e6..6b03e6ac 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -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;