* 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
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;
}
}
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
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 {
/* 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;
/* 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;
/* 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;