* src/color.c (found_in_list): Factor out this triple repetition.
* 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.
GNU nano 2.5.3 - 2016.02.25
if (not_compiled) {
item->ext = (regex_t *)nmalloc(sizeof(regex_t));
- regcomp(item->ext, fixbounds(item->ext_regex), REG_EXTENDED);
+ regcomp(item->ext, fixbounds(item->full_regex), REG_EXTENDED);
}
if (regexec(item->ext, shibboleth, 0, NULL, 0) == 0)
#ifndef DISABLE_COLOR
void free_list_item(regexlisttype *dropit)
{
- free(dropit->ext_regex);
+ free(dropit->full_regex);
if (dropit->ext != NULL)
regfree(dropit->ext);
free(dropit->ext);
} colortype;
typedef struct regexlisttype {
- char *ext_regex;
- /* The regexstrings for the things that match this syntax. */
+ char *full_regex;
+ /* A regex string to match things that imply a certain syntax. */
regex_t *ext;
/* The compiled regexes. */
struct regexlisttype *next;
/* Save the extension regex if it's valid. */
if (nregcomp(fileregptr, REG_NOSUB)) {
- newext->ext_regex = mallocstrcpy(NULL, fileregptr);
+ newext->full_regex = mallocstrcpy(NULL, fileregptr);
newext->ext = NULL;
if (endext == NULL)
/* Save the regex string if it's valid. */
if (nregcomp(regexstring, 0)) {
- newheader->ext_regex = mallocstrcpy(NULL, regexstring);
+ newheader->full_regex = mallocstrcpy(NULL, regexstring);
newheader->ext = NULL;
if (endheader == NULL)
/* Save the regex string if it's valid. */
if (nregcomp(regexstring, REG_NOSUB)) {
- newmagic->ext_regex = mallocstrcpy(NULL, regexstring);
+ newmagic->full_regex = mallocstrcpy(NULL, regexstring);
newmagic->ext = NULL;
if (endmagic == NULL)