From: Richard Russon Date: Sat, 2 Sep 2017 15:09:12 +0000 (+0100) Subject: rename: rx -> regex X-Git-Tag: neomutt-20170907~4^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98b29e912115f9842c5260d7f5831a8e4fad47ad;p=neomutt rename: rx -> regex Rename all structs and functions to uniformly use the prefix 'regex'. --- diff --git a/alias.c b/alias.c index a3ec93be4..37421c41d 100644 --- a/alias.c +++ b/alias.c @@ -671,10 +671,10 @@ bool mutt_addr_is_user(struct Address *addr) return true; } - if (mutt_match_rx_list(addr->mailbox, Alternates)) + if (mutt_match_regex_list(addr->mailbox, Alternates)) { mutt_debug(5, "mutt_addr_is_user: yes, %s matched by alternates.\n", addr->mailbox); - if (mutt_match_rx_list(addr->mailbox, UnAlternates)) + if (mutt_match_regex_list(addr->mailbox, UnAlternates)) mutt_debug(5, "mutt_addr_is_user: but, %s matched by unalternates.\n", addr->mailbox); else return true; diff --git a/browser.c b/browser.c index 4482e66d1..585773438 100644 --- a/browser.c +++ b/browser.c @@ -677,7 +677,7 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state, continue; if (prefix && *prefix && (strncmp(prefix, nntp_data->group, strlen(prefix)) != 0)) continue; - if (!((regexec(Mask.rx, nntp_data->group, 0, NULL, 0) == 0) ^ Mask.not)) + if (!((regexec(Mask.regex, nntp_data->group, 0, NULL, 0) == 0) ^ Mask.not)) continue; add_folder(menu, state, nntp_data->group, NULL, NULL, NULL, nntp_data); } @@ -731,7 +731,7 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state, if (prefix && *prefix && (mutt_strncmp(prefix, de->d_name, mutt_strlen(prefix)) != 0)) continue; - if (!((regexec(Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not)) + if (!((regexec(Mask.regex, de->d_name, 0, NULL, 0) == 0) ^ Mask.not)) continue; mutt_concat_path(buffer, d, de->d_name, sizeof(buffer)); @@ -1703,9 +1703,9 @@ void _mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numf else { mutt_str_replace(&Mask.pattern, buf); - regfree(Mask.rx); - FREE(&Mask.rx); - Mask.rx = rx; + regfree(Mask.regex); + FREE(&Mask.regex); + Mask.regex = rx; Mask.not = not; destroy_state(&state); diff --git a/color.c b/color.c index 8ab421403..a3b6f18af 100644 --- a/color.c +++ b/color.c @@ -178,7 +178,7 @@ static void free_color_line(struct ColorLine **l, int free_colors) * type for regular expressions. */ - regfree(&tmp->rx); + regfree(&tmp->regex); mutt_pattern_free(&tmp->color_pattern); FREE(&tmp->pattern); FREE(l); @@ -663,9 +663,9 @@ static int add_pattern(struct ColorLine **top, const char *s, int sensitive, int for (int i = 0; Context && i < Context->msgcount; i++) Context->hdrs[i]->pair = 0; } - else if ((r = REGCOMP(&tmp->rx, s, (sensitive ? mutt_which_case(s) : REG_ICASE))) != 0) + else if ((r = REGCOMP(&tmp->regex, s, (sensitive ? mutt_which_case(s) : REG_ICASE))) != 0) { - regerror(r, &tmp->rx, err->data, err->dsize); + regerror(r, &tmp->regex, err->data, err->dsize); free_color_line(&tmp, 1); return -1; } diff --git a/curs_main.c b/curs_main.c index 3e18ccbd3..d78227c02 100644 --- a/curs_main.c +++ b/curs_main.c @@ -727,7 +727,7 @@ void mutt_draw_statusline(int cols, const char *buf, int buflen) { regmatch_t pmatch[cl->match + 1]; - if (regexec(&cl->rx, buf + offset, cl->match + 1, pmatch, 0) != 0) + if (regexec(&cl->regex, buf + offset, cl->match + 1, pmatch, 0) != 0) continue; /* regex doesn't match the status bar */ int first = pmatch[cl->match].rm_so + offset; diff --git a/globals.h b/globals.h index bf970d31a..e5eebf208 100644 --- a/globals.h +++ b/globals.h @@ -215,15 +215,15 @@ WHERE struct ListHead MailToAllow INITVAL(STAILQ_HEAD_INITIALIZER(MailToAllow)); WHERE struct ListHead MimeLookupList INITVAL(STAILQ_HEAD_INITIALIZER(MimeLookupList)); WHERE struct ListHead UnIgnore INITVAL(STAILQ_HEAD_INITIALIZER(UnIgnore)); -WHERE struct RxList *Alternates; -WHERE struct RxList *UnAlternates; -WHERE struct RxList *MailLists; -WHERE struct RxList *UnMailLists; -WHERE struct RxList *SubscribedLists; -WHERE struct RxList *UnSubscribedLists; +WHERE struct RegexList *Alternates; +WHERE struct RegexList *UnAlternates; +WHERE struct RegexList *MailLists; +WHERE struct RegexList *UnMailLists; +WHERE struct RegexList *SubscribedLists; +WHERE struct RegexList *UnSubscribedLists; WHERE struct ReplaceList *SpamList; -WHERE struct RxList *NoSpamList; -WHERE struct ReplaceList *SubjectRxList; +WHERE struct RegexList *NoSpamList; +WHERE struct ReplaceList *SubjectRegexList; /* bit vector for the yes/no/ask variable type */ #ifdef MAIN_C diff --git a/group.c b/group.c index 05acb7641..19e0f37cc 100644 --- a/group.c +++ b/group.c @@ -56,7 +56,7 @@ static void group_remove(struct Group *g) return; hash_delete(Groups, g->name, g, NULL); rfc822_free_address(&g->as); - mutt_free_rx_list(&g->rs); + mutt_free_regex_list(&g->rs); FREE(&g->name); FREE(&g); } @@ -134,14 +134,14 @@ static int group_remove_adrlist(struct Group *g, struct Address *a) return 0; } -static int group_add_rx(struct Group *g, const char *s, int flags, struct Buffer *err) +static int group_add_regex(struct Group *g, const char *s, int flags, struct Buffer *err) { - return mutt_add_to_rx_list(&g->rs, s, flags, err); + return mutt_add_to_regex_list(&g->rs, s, flags, err); } -static int group_remove_rx(struct Group *g, const char *s) +static int group_remove_regex(struct Group *g, const char *s) { - return mutt_remove_from_rx_list(&g->rs, s); + return mutt_remove_from_regex_list(&g->rs, s); } void mutt_group_context_add_adrlist(struct GroupContext *ctx, struct Address *a) @@ -164,24 +164,24 @@ int mutt_group_context_remove_adrlist(struct GroupContext *ctx, struct Address * return rv; } -int mutt_group_context_add_rx(struct GroupContext *ctx, const char *s, +int mutt_group_context_add_regex(struct GroupContext *ctx, const char *s, int flags, struct Buffer *err) { int rv = 0; for (; (!rv) && ctx; ctx = ctx->next) - rv = group_add_rx(ctx->g, s, flags, err); + rv = group_add_regex(ctx->g, s, flags, err); return rv; } -int mutt_group_context_remove_rx(struct GroupContext *ctx, const char *s) +int mutt_group_context_remove_regex(struct GroupContext *ctx, const char *s) { int rv = 0; for (; (!rv) && ctx; ctx = ctx->next) { - rv = group_remove_rx(ctx->g, s); + rv = group_remove_regex(ctx->g, s); if (empty_group(ctx->g)) group_remove(ctx->g); } @@ -195,7 +195,7 @@ bool mutt_group_match(struct Group *g, const char *s) if (s && g) { - if (mutt_match_rx_list(s, g->rs)) + if (mutt_match_regex_list(s, g->rs)) return true; for (ap = g->as; ap; ap = ap->next) if (ap->mailbox && (mutt_strcasecmp(s, ap->mailbox) == 0)) diff --git a/group.h b/group.h index 30569d1bf..ca325a011 100644 --- a/group.h +++ b/group.h @@ -38,7 +38,7 @@ struct Buffer; struct Group { struct Address *as; - struct RxList *rs; + struct RegexList *rs; char *name; }; @@ -54,12 +54,12 @@ struct GroupContext void mutt_group_context_add(struct GroupContext **ctx, struct Group *group); void mutt_group_context_destroy(struct GroupContext **ctx); void mutt_group_context_add_adrlist(struct GroupContext *ctx, struct Address *a); -int mutt_group_context_add_rx(struct GroupContext *ctx, const char *s, int flags, struct Buffer *err); +int mutt_group_context_add_regex(struct GroupContext *ctx, const char *s, int flags, struct Buffer *err); bool mutt_group_match(struct Group *g, const char *s); int mutt_group_context_clear(struct GroupContext **ctx); -int mutt_group_context_remove_rx(struct GroupContext *ctx, const char *s); +int mutt_group_context_remove_regex(struct GroupContext *ctx, const char *s); int mutt_group_context_remove_adrlist(struct GroupContext *ctx, struct Address *a); struct Group *mutt_pattern_group(const char *k); diff --git a/hcache/hcache.c b/hcache/hcache.c index 745a089cf..5f5795db6 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -760,7 +760,7 @@ header_cache_t *mutt_hcache_open(const char *path, const char *folder, hcache_na } digest; struct Md5Ctx ctx; struct ReplaceList *spam = NULL; - struct RxList *nospam = NULL; + struct RegexList *nospam = NULL; hcachever = HCACHEVER; @@ -772,14 +772,14 @@ header_cache_t *mutt_hcache_open(const char *path, const char *folder, hcache_na /* Mix in user's spam list */ for (spam = SpamList; spam; spam = spam->next) { - md5_process_bytes(spam->rx->pattern, strlen(spam->rx->pattern), &ctx); + md5_process_bytes(spam->regex->pattern, strlen(spam->regex->pattern), &ctx); md5_process_bytes(spam->template, strlen(spam->template), &ctx); } /* Mix in user's nospam list */ for (nospam = NoSpamList; nospam; nospam = nospam->next) { - md5_process_bytes(nospam->rx->pattern, strlen(nospam->rx->pattern), &ctx); + md5_process_bytes(nospam->regex->pattern, strlen(nospam->regex->pattern), &ctx); } /* Get a hash and take its bytes as an (unsigned int) hash version */ diff --git a/hdrline.c b/hdrline.c index 90e054aca..a5b1f5f0d 100644 --- a/hdrline.c +++ b/hdrline.c @@ -72,16 +72,16 @@ enum FlagChars bool mutt_is_mail_list(struct Address *addr) { - if (!mutt_match_rx_list(addr->mailbox, UnMailLists)) - return mutt_match_rx_list(addr->mailbox, MailLists); + if (!mutt_match_regex_list(addr->mailbox, UnMailLists)) + return mutt_match_regex_list(addr->mailbox, MailLists); return false; } bool mutt_is_subscribed_list(struct Address *addr) { - if (!mutt_match_rx_list(addr->mailbox, UnMailLists) && - !mutt_match_rx_list(addr->mailbox, UnSubscribedLists)) - return mutt_match_rx_list(addr->mailbox, SubscribedLists); + if (!mutt_match_regex_list(addr->mailbox, UnMailLists) && + !mutt_match_regex_list(addr->mailbox, UnSubscribedLists)) + return mutt_match_regex_list(addr->mailbox, SubscribedLists); return false; } @@ -442,13 +442,13 @@ static char *apply_subject_mods(struct Envelope *env) if (!env) return NULL; - if (!SubjectRxList) + if (!SubjectRegexList) return env->subject; if (env->subject == NULL || *env->subject == '\0') return env->disp_subj = NULL; - env->disp_subj = mutt_apply_replace(NULL, 0, env->subject, SubjectRxList); + env->disp_subj = mutt_apply_replace(NULL, 0, env->subject, SubjectRegexList); return env->disp_subj; } @@ -1034,7 +1034,7 @@ static const char *hdr_format_str(char *dest, size_t destlen, size_t col, int co char *subj = NULL; if (hdr->env->disp_subj) subj = hdr->env->disp_subj; - else if (SubjectRxList) + else if (SubjectRegexList) subj = apply_subject_mods(hdr->env); else subj = hdr->env->subject; diff --git a/hook.c b/hook.c index d6b5e2623..af24ab34e 100644 --- a/hook.c +++ b/hook.c @@ -54,7 +54,7 @@ static TAILQ_HEAD(HookHead, Hook) Hooks = TAILQ_HEAD_INITIALIZER(Hooks); struct Hook { int type; /**< hook type */ - struct Regex rx; /**< regular expression */ + struct Regex regex; /**< regular expression */ char *command; /**< filename, command or pattern to execute */ struct Pattern *pattern; /**< used for fcc,save,send-hook */ TAILQ_ENTRY(Hook) entries; @@ -186,7 +186,7 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, } } else if (ptr->type == data && - ptr->rx.not == not&&(mutt_strcmp(pattern.data, ptr->rx.pattern) == 0)) + ptr->regex.not == not&&(mutt_strcmp(pattern.data, ptr->regex.pattern) == 0)) { if (data & (MUTT_FOLDERHOOK | MUTT_SENDHOOK | MUTT_SEND2HOOK | MUTT_MESSAGEHOOK | MUTT_ACCOUNTHOOK | MUTT_REPLYHOOK | MUTT_CRYPTHOOK | @@ -247,9 +247,9 @@ int mutt_parse_hook(struct Buffer *buf, struct Buffer *s, unsigned long data, ptr->type = data; ptr->command = command.data; ptr->pattern = pat; - ptr->rx.pattern = pattern.data; - ptr->rx.rx = rx; - ptr->rx.not = not; + ptr->regex.pattern = pattern.data; + ptr->regex.regex = rx; + ptr->regex.not = not; TAILQ_INSERT_TAIL(&Hooks, ptr, entries); return 0; @@ -263,10 +263,10 @@ error: static void delete_hook(struct Hook *h) { FREE(&h->command); - FREE(&h->rx.pattern); - if (h->rx.rx) + FREE(&h->regex.pattern); + if (h->regex.regex) { - regfree(h->rx.rx); + regfree(h->regex.regex); } mutt_pattern_free(&h->pattern); FREE(&h); @@ -348,7 +348,7 @@ void mutt_folder_hook(char *path) if (tmp->type & MUTT_FOLDERHOOK) { - if ((regexec(tmp->rx.rx, path, 0, NULL, 0) == 0) ^ tmp->rx.not) + if ((regexec(tmp->regex.regex, path, 0, NULL, 0) == 0) ^ tmp->regex.not) { if (mutt_parse_rc_line(tmp->command, &token, &err) == -1) { @@ -377,7 +377,7 @@ char *mutt_find_hook(int type, const char *pat) { if (tmp->type & type) { - if (regexec(tmp->rx.rx, pat, 0, NULL, 0) == 0) + if (regexec(tmp->regex.regex, pat, 0, NULL, 0) == 0) return tmp->command; } } @@ -403,7 +403,7 @@ void mutt_message_hook(struct Context *ctx, struct Header *hdr, int type) continue; if (hook->type & type) - if ((mutt_pattern_exec(hook->pattern, 0, ctx, hdr, &cache) > 0) ^ hook->rx.not) + if ((mutt_pattern_exec(hook->pattern, 0, ctx, hdr, &cache) > 0) ^ hook->regex.not) { if (mutt_parse_rc_line(hook->command, &token, &err) == -1) { @@ -440,7 +440,7 @@ static int addr_hook(char *path, size_t pathlen, int type, struct Context *ctx, continue; if (hook->type & type) - if ((mutt_pattern_exec(hook->pattern, 0, ctx, hdr, &cache) > 0) ^ hook->rx.not) + if ((mutt_pattern_exec(hook->pattern, 0, ctx, hdr, &cache) > 0) ^ hook->regex.not) { mutt_make_string(path, pathlen, hook->command, ctx, hdr); return 0; @@ -507,7 +507,7 @@ static char *_mutt_string_hook(const char *match, int hook) TAILQ_FOREACH(tmp, &Hooks, entries) { if ((tmp->type & hook) && - ((match && regexec(tmp->rx.rx, match, 0, NULL, 0) == 0) ^ tmp->rx.not)) + ((match && regexec(tmp->regex.regex, match, 0, NULL, 0) == 0) ^ tmp->regex.not)) return tmp->command; } return NULL; @@ -520,7 +520,7 @@ static void _mutt_list_hook(struct ListHead *matches, const char *match, int hoo TAILQ_FOREACH(tmp, &Hooks, entries) { if ((tmp->type & hook) && - ((match && regexec(tmp->rx.rx, match, 0, NULL, 0) == 0) ^ tmp->rx.not)) + ((match && regexec(tmp->regex.regex, match, 0, NULL, 0) == 0) ^ tmp->regex.not)) mutt_list_insert_tail(matches, safe_strdup(tmp->command)); } } @@ -565,7 +565,7 @@ void mutt_account_hook(const char *url) if (!(hook->command && (hook->type & MUTT_ACCOUNTHOOK))) continue; - if ((regexec(hook->rx.rx, url, 0, NULL, 0) == 0) ^ hook->rx.not) + if ((regexec(hook->regex.regex, url, 0, NULL, 0) == 0) ^ hook->regex.not) { inhook = true; diff --git a/imap/browse.c b/imap/browse.c index cac7f7f6f..a6b78f74f 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -80,7 +80,7 @@ static void imap_add_folder(char delim, char *folder, int noselect, int noinferi /* apply filemask filter. This should really be done at menu setup rather * than at scan, since it's so expensive to scan. But that's big changes * to browser.c */ - if (!((regexec(Mask.rx, relpath, 0, NULL, 0) == 0) ^ Mask.not)) + if (!((regexec(Mask.regex, relpath, 0, NULL, 0) == 0) ^ Mask.not)) { FREE(&mx.mbox); return; diff --git a/init.c b/init.c index 27aa39f8c..1432ee6c3 100644 --- a/init.c +++ b/init.c @@ -179,12 +179,12 @@ static int parse_regex(int idx, struct Buffer *tmp, struct Buffer *err) if (ptr->pattern) { FREE(&ptr->pattern); - regfree((regex_t *) ptr->rx); - FREE(&ptr->rx); + regfree((regex_t *) ptr->regex); + FREE(&ptr->regex); } ptr->pattern = safe_strdup(tmp->data); - ptr->rx = rx; + ptr->regex = rx; ptr->not = not; return 1; @@ -396,7 +396,7 @@ int mutt_option_set(const struct Option *val, struct Buffer *err) if (CUR_ENV && CUR_ENV->subject) { CUR_ENV->real_subj = - (regexec(ReplyRegexp.rx, CUR_ENV->subject, 1, pmatch, 0)) ? + (regexec(ReplyRegexp.regex, CUR_ENV->subject, 1, pmatch, 0)) ? CUR_ENV->subject : CUR_ENV->subject + pmatch[0].rm_eo; } @@ -717,10 +717,10 @@ static void free_opt(struct Option *p) case DT_REGEX: pp = (struct Regex *) p->data; FREE(&pp->pattern); - if (pp->rx) + if (pp->regex) { - regfree(pp->rx); - FREE(&pp->rx); + regfree(pp->regex); + FREE(&pp->regex); } break; case DT_PATH: @@ -738,13 +738,13 @@ void mutt_free_opts(void) for (int i = 0; MuttVars[i].option; i++) free_opt(MuttVars + i); - mutt_free_rx_list(&Alternates); - mutt_free_rx_list(&UnAlternates); - mutt_free_rx_list(&MailLists); - mutt_free_rx_list(&UnMailLists); - mutt_free_rx_list(&SubscribedLists); - mutt_free_rx_list(&UnSubscribedLists); - mutt_free_rx_list(&NoSpamList); + mutt_free_regex_list(&Alternates); + mutt_free_regex_list(&UnAlternates); + mutt_free_regex_list(&MailLists); + mutt_free_regex_list(&UnMailLists); + mutt_free_regex_list(&SubscribedLists); + mutt_free_regex_list(&UnSubscribedLists); + mutt_free_regex_list(&NoSpamList); } static void add_to_stailq(struct ListHead *head, const char *str) @@ -765,14 +765,14 @@ static void add_to_stailq(struct ListHead *head, const char *str) mutt_list_insert_tail(head, safe_strdup(str)); } -static struct RxList *new_rx_list(void) +static struct RegexList *new_regex_list(void) { - return safe_calloc(1, sizeof(struct RxList)); + return safe_calloc(1, sizeof(struct RegexList)); } -int mutt_add_to_rx_list(struct RxList **list, const char *s, int flags, struct Buffer *err) +int mutt_add_to_regex_list(struct RegexList **list, const char *s, int flags, struct Buffer *err) { - struct RxList *t = NULL, *last = NULL; + struct RegexList *t = NULL, *last = NULL; struct Regex *rx = NULL; if (!s || !*s) @@ -787,7 +787,7 @@ int mutt_add_to_rx_list(struct RxList **list, const char *s, int flags, struct B /* check to make sure the item is not already on this list */ for (last = *list; last; last = last->next) { - if (mutt_strcasecmp(rx->pattern, last->rx->pattern) == 0) + if (mutt_strcasecmp(rx->pattern, last->regex->pattern) == 0) { /* already on the list, so just ignore it */ last = NULL; @@ -799,8 +799,8 @@ int mutt_add_to_rx_list(struct RxList **list, const char *s, int flags, struct B if (!*list || last) { - t = new_rx_list(); - t->rx = rx; + t = new_regex_list(); + t->regex = rx; if (last) { last->next = t; @@ -824,10 +824,10 @@ static int remove_from_replace_list(struct ReplaceList **list, const char *pat) cur = *list; if (!cur) return 0; - if (cur->rx && (mutt_strcmp(cur->rx->pattern, pat) == 0)) + if (cur->regex && (mutt_strcmp(cur->regex->pattern, pat) == 0)) { *list = cur->next; - mutt_free_regexp(&cur->rx); + mutt_free_regexp(&cur->regex); FREE(&cur->template); FREE(&cur); return 1; @@ -836,10 +836,10 @@ static int remove_from_replace_list(struct ReplaceList **list, const char *pat) prev = cur; for (cur = prev->next; cur;) { - if (mutt_strcmp(cur->rx->pattern, pat) == 0) + if (mutt_strcmp(cur->regex->pattern, pat) == 0) { prev->next = cur->next; - mutt_free_regexp(&cur->rx); + mutt_free_regexp(&cur->regex); FREE(&cur->template); FREE(&cur); cur = prev->next; @@ -877,7 +877,7 @@ static int add_to_replace_list(struct ReplaceList **list, const char *pat, /* check to make sure the item is not already on this list */ for (last = *list; last; last = last->next) { - if (mutt_strcasecmp(rx->pattern, last->rx->pattern) == 0) + if (mutt_strcasecmp(rx->pattern, last->regex->pattern) == 0) { /* Already on the list. Formerly we just skipped this case, but * now we're supporting removals, which means we're supporting @@ -899,7 +899,7 @@ static int add_to_replace_list(struct ReplaceList **list, const char *pat, if (!t) { t = new_replace_list(); - t->rx = rx; + t->regex = rx; rx = NULL; if (last) last->next = t; @@ -928,7 +928,7 @@ static int add_to_replace_list(struct ReplaceList **list, const char *pat, p++; } - if (t->nmatch > t->rx->rx->re_nsub) + if (t->nmatch > t->regex->regex->re_nsub) { snprintf(err->data, err->dsize, "%s", _("Not enough subexpressions for " "template")); @@ -1166,12 +1166,12 @@ static int parse_alternates(struct Buffer *buf, struct Buffer *s, if (parse_group_context(&gc, buf, s, data, err) == -1) goto bail; - mutt_remove_from_rx_list(&UnAlternates, buf->data); + mutt_remove_from_regex_list(&UnAlternates, buf->data); - if (mutt_add_to_rx_list(&Alternates, buf->data, REG_ICASE, err) != 0) + if (mutt_add_to_regex_list(&Alternates, buf->data, REG_ICASE, err) != 0) goto bail; - if (mutt_group_context_add_rx(gc, buf->data, REG_ICASE, err) != 0) + if (mutt_group_context_add_regex(gc, buf->data, REG_ICASE, err) != 0) goto bail; } while (MoreArgs(s)); @@ -1190,10 +1190,10 @@ static int parse_unalternates(struct Buffer *buf, struct Buffer *s, do { mutt_extract_token(buf, s, 0); - mutt_remove_from_rx_list(&Alternates, buf->data); + mutt_remove_from_regex_list(&Alternates, buf->data); if ((mutt_strcmp(buf->data, "*") != 0) && - mutt_add_to_rx_list(&UnAlternates, buf->data, REG_ICASE, err) != 0) + mutt_add_to_regex_list(&UnAlternates, buf->data, REG_ICASE, err) != 0) return -1; } while (MoreArgs(s)); @@ -1332,7 +1332,7 @@ static int parse_spam_list(struct Buffer *buf, struct Buffer *s, /* If not, try to remove from the nospam list. */ else { - mutt_remove_from_rx_list(&NoSpamList, buf->data); + mutt_remove_from_regex_list(&NoSpamList, buf->data); } return 0; @@ -1347,7 +1347,7 @@ static int parse_spam_list(struct Buffer *buf, struct Buffer *s, if (mutt_strcmp(buf->data, "*") == 0) { mutt_free_replace_list(&SpamList); - mutt_free_rx_list(&NoSpamList); + mutt_free_regex_list(&NoSpamList); return 0; } @@ -1356,7 +1356,7 @@ static int parse_spam_list(struct Buffer *buf, struct Buffer *s, return 0; /* Otherwise, add it to the nospam list. */ - if (mutt_add_to_rx_list(&NoSpamList, buf->data, REG_ICASE, err) != 0) + if (mutt_add_to_regex_list(&NoSpamList, buf->data, REG_ICASE, err) != 0) return -1; return 0; @@ -1421,12 +1421,12 @@ static int parse_lists(struct Buffer *buf, struct Buffer *s, unsigned long data, if (parse_group_context(&gc, buf, s, data, err) == -1) goto bail; - mutt_remove_from_rx_list(&UnMailLists, buf->data); + mutt_remove_from_regex_list(&UnMailLists, buf->data); - if (mutt_add_to_rx_list(&MailLists, buf->data, REG_ICASE, err) != 0) + if (mutt_add_to_regex_list(&MailLists, buf->data, REG_ICASE, err) != 0) goto bail; - if (mutt_group_context_add_rx(gc, buf->data, REG_ICASE, err) != 0) + if (mutt_group_context_add_regex(gc, buf->data, REG_ICASE, err) != 0) goto bail; } while (MoreArgs(s)); @@ -1484,9 +1484,9 @@ static int parse_group(struct Buffer *buf, struct Buffer *s, unsigned long data, case GS_RX: if (data == MUTT_GROUP && - mutt_group_context_add_rx(gc, buf->data, REG_ICASE, err) != 0) + mutt_group_context_add_regex(gc, buf->data, REG_ICASE, err) != 0) goto bail; - else if (data == MUTT_UNGROUP && mutt_group_context_remove_rx(gc, buf->data) < 0) + else if (data == MUTT_UNGROUP && mutt_group_context_remove_regex(gc, buf->data) < 0) goto bail; break; @@ -1578,13 +1578,13 @@ static int parse_attach_list(struct Buffer *buf, struct Buffer *s, tmpminor[len + 2] = '\0'; a->major_int = mutt_check_mime_type(a->major); - ret = REGCOMP(&a->minor_rx, tmpminor, REG_ICASE); + ret = REGCOMP(&a->minor_regex, tmpminor, REG_ICASE); FREE(&tmpminor); if (ret) { - regerror(ret, &a->minor_rx, err->data, err->dsize); + regerror(ret, &a->minor_regex, err->data, err->dsize); FREE(&a->major); FREE(&a); return -1; @@ -1640,7 +1640,7 @@ static int parse_unattach_list(struct Buffer *buf, struct Buffer *s, { mutt_debug(5, "parse_unattach_list: removed %s/%s [%d]\n", a->major, a->minor, a->major_int); - regfree(&a->minor_rx); + regfree(&a->minor_regex); FREE(&a->major); STAILQ_REMOVE(head, np, ListNode, entries); FREE(&np->data); @@ -1774,11 +1774,11 @@ static int parse_unlists(struct Buffer *buf, struct Buffer *s, do { mutt_extract_token(buf, s, 0); - mutt_remove_from_rx_list(&SubscribedLists, buf->data); - mutt_remove_from_rx_list(&MailLists, buf->data); + mutt_remove_from_regex_list(&SubscribedLists, buf->data); + mutt_remove_from_regex_list(&MailLists, buf->data); if ((mutt_strcmp(buf->data, "*") != 0) && - mutt_add_to_rx_list(&UnMailLists, buf->data, REG_ICASE, err) != 0) + mutt_add_to_regex_list(&UnMailLists, buf->data, REG_ICASE, err) != 0) return -1; } while (MoreArgs(s)); @@ -1797,14 +1797,14 @@ static int parse_subscribe(struct Buffer *buf, struct Buffer *s, if (parse_group_context(&gc, buf, s, data, err) == -1) goto bail; - mutt_remove_from_rx_list(&UnMailLists, buf->data); - mutt_remove_from_rx_list(&UnSubscribedLists, buf->data); + mutt_remove_from_regex_list(&UnMailLists, buf->data); + mutt_remove_from_regex_list(&UnSubscribedLists, buf->data); - if (mutt_add_to_rx_list(&MailLists, buf->data, REG_ICASE, err) != 0) + if (mutt_add_to_regex_list(&MailLists, buf->data, REG_ICASE, err) != 0) goto bail; - if (mutt_add_to_rx_list(&SubscribedLists, buf->data, REG_ICASE, err) != 0) + if (mutt_add_to_regex_list(&SubscribedLists, buf->data, REG_ICASE, err) != 0) goto bail; - if (mutt_group_context_add_rx(gc, buf->data, REG_ICASE, err) != 0) + if (mutt_group_context_add_regex(gc, buf->data, REG_ICASE, err) != 0) goto bail; } while (MoreArgs(s)); @@ -1822,10 +1822,10 @@ static int parse_unsubscribe(struct Buffer *buf, struct Buffer *s, do { mutt_extract_token(buf, s, 0); - mutt_remove_from_rx_list(&SubscribedLists, buf->data); + mutt_remove_from_regex_list(&SubscribedLists, buf->data); if ((mutt_strcmp(buf->data, "*") != 0) && - mutt_add_to_rx_list(&UnSubscribedLists, buf->data, REG_ICASE, err) != 0) + mutt_add_to_regex_list(&UnSubscribedLists, buf->data, REG_ICASE, err) != 0) return -1; } while (MoreArgs(s)); @@ -2133,10 +2133,10 @@ static void restore_default(struct Option *p) int flags = 0; FREE(&pp->pattern); - if (pp->rx) + if (pp->regex) { - regfree(pp->rx); - FREE(&pp->rx); + regfree(pp->regex); + FREE(&pp->regex); } if (p->init) @@ -2144,7 +2144,7 @@ static void restore_default(struct Option *p) int retval; char *s = (char *) p->init; - pp->rx = safe_calloc(1, sizeof(regex_t)); + pp->regex = safe_calloc(1, sizeof(regex_t)); pp->pattern = safe_strdup((char *) p->init); if (mutt_strcmp(p->option, "mask") != 0) flags |= mutt_which_case((const char *) p->init); @@ -2153,17 +2153,17 @@ static void restore_default(struct Option *p) s++; pp->not = 1; } - retval = REGCOMP(pp->rx, s, flags); + retval = REGCOMP(pp->regex, s, flags); if (retval != 0) { char msgbuf[STRING]; - regerror(retval, pp->rx, msgbuf, sizeof(msgbuf)); + regerror(retval, pp->regex, msgbuf, sizeof(msgbuf)); fprintf(stderr, _("restore_default(%s): error in regexp: %s\n"), p->option, pp->pattern); fprintf(stderr, "%s\n", msgbuf); mutt_sleep(0); FREE(&pp->pattern); - FREE(&pp->rx); + FREE(&pp->regex); } } } @@ -2818,7 +2818,7 @@ static int parse_set(struct Buffer *tmp, struct Buffer *s, unsigned long data, if (CUR_ENV && CUR_ENV->subject) { CUR_ENV->real_subj = - (regexec(ReplyRegexp.rx, CUR_ENV->subject, 1, pmatch, 0)) ? + (regexec(ReplyRegexp.regex, CUR_ENV->subject, 1, pmatch, 0)) ? CUR_ENV->subject : CUR_ENV->subject + pmatch[0].rm_eo; } diff --git a/init.h b/init.h index 64914cf89..550151422 100644 --- a/init.h +++ b/init.h @@ -4658,7 +4658,7 @@ const struct Command Commands[] = { { "source", parse_source, 0 }, { "spam", parse_spam_list, MUTT_SPAM }, { "startup-hook", mutt_parse_hook, MUTT_STARTUPHOOK | MUTT_GLOBALHOOK }, - { "subjectrx", parse_subjectrx_list, UL &SubjectRxList }, + { "subjectrx", parse_subjectrx_list, UL &SubjectRegexList }, { "subscribe", parse_subscribe, 0 }, #ifdef USE_NOTMUCH { "tag-formats", parse_tag_formats, 0 }, @@ -4690,7 +4690,7 @@ const struct Command Commands[] = { #ifdef USE_SIDEBAR { "unsidebar_whitelist", parse_path_unlist, UL &SidebarWhitelist }, #endif - { "unsubjectrx", parse_unsubjectrx_list, UL &SubjectRxList }, + { "unsubjectrx", parse_unsubjectrx_list, UL &SubjectRegexList }, { "unsubscribe", parse_unsubscribe, 0 }, #ifdef USE_NOTMUCH { "unvirtual-mailboxes", mutt_parse_unmailboxes, MUTT_VIRTUAL }, diff --git a/lib/file.c b/lib/file.c index 3d1a80797..82f49a0e7 100644 --- a/lib/file.c +++ b/lib/file.c @@ -38,7 +38,7 @@ * | mutt_quote_filename() | Quote a filename to survive the shell's quoting rules * | mutt_read_line() | Read a line from a file * | mutt_rmtree() | Recursively remove a directory - * | mutt_rx_sanitize_string() | Escape any regex-magic characters in a string + * | mutt_regex_sanitize_string() | Escape any regex-magic characters in a string * | mutt_sanitize_filename() | Replace unsafe characters in a filename * | mutt_set_mtime() | Set the modification time of one file from another * | mutt_touch_atime() | Set the access time to current time @@ -591,14 +591,14 @@ void mutt_sanitize_filename(char *f, short slash) } /** - * mutt_rx_sanitize_string - Escape any regex-magic characters in a string + * mutt_regex_sanitize_string - Escape any regex-magic characters in a string * @param dest Buffer for result * @param destlen Length of buffer * @param src String to transform * @retval 0 Success * @retval -1 Error */ -int mutt_rx_sanitize_string(char *dest, size_t destlen, const char *src) +int mutt_regex_sanitize_string(char *dest, size_t destlen, const char *src) { while (*src && (--destlen > 2)) { diff --git a/lib/file.h b/lib/file.h index de96444e1..3ff23cd46 100644 --- a/lib/file.h +++ b/lib/file.h @@ -49,7 +49,7 @@ int mutt_mkdir(const char *path, mode_t mode); size_t mutt_quote_filename(char *d, size_t l, const char *f); char * mutt_read_line(char *s, size_t *size, FILE *fp, int *line, int flags); int mutt_rmtree(const char *path); -int mutt_rx_sanitize_string(char *dest, size_t destlen, const char *src); +int mutt_regex_sanitize_string(char *dest, size_t destlen, const char *src); void mutt_sanitize_filename(char *f, short slash); void mutt_set_mtime(const char *from, const char *to); void mutt_touch_atime(int f); diff --git a/mutt.h b/mutt.h index 22e2fc82a..ba61b8724 100644 --- a/mutt.h +++ b/mutt.h @@ -31,7 +31,7 @@ #include struct ReplaceList; -struct RxList; +struct RegexList; struct State; struct ListHead; struct Mapping; @@ -310,12 +310,12 @@ enum QuadOptionVars #define MUTT_X_MOZILLA_KEYS (1 << 2) /**< tbird */ #define MUTT_KEYWORDS (1 << 3) /**< rfc2822 */ -void mutt_free_rx_list(struct RxList **list); +void mutt_free_regex_list(struct RegexList **list); void mutt_free_replace_list(struct ReplaceList **list); int mutt_matches_ignore(const char *s); /* add an element to a list */ -int mutt_remove_from_rx_list(struct RxList **l, const char *str); +int mutt_remove_from_regex_list(struct RegexList **l, const char *str); void mutt_init(int skip_sys_rc, struct ListHead *commands); @@ -332,7 +332,7 @@ struct AttachMatch char *major; int major_int; char *minor; - regex_t minor_rx; + regex_t minor_regex; }; #define MUTT_PARTS_TOPLEVEL (1 << 0) /* is the top-level part */ diff --git a/mutt_curses.h b/mutt_curses.h index 988bc05ec..c0b5a8f8f 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -192,7 +192,7 @@ enum ColorId */ struct ColorLine { - regex_t rx; + regex_t regex; int match; /**< which substringmap 0 for old behaviour */ char *pattern; struct Pattern *color_pattern; /**< compiled pattern to speed up index color diff --git a/mutt_regex.h b/mutt_regex.h index 32d1fe964..e2e097aa4 100644 --- a/mutt_regex.h +++ b/mutt_regex.h @@ -45,18 +45,18 @@ */ struct Regex { - char *pattern; /**< printable version */ - regex_t *rx; /**< compiled expression */ - int not; /**< do not match */ + char *pattern; /**< printable version */ + regex_t *regex; /**< compiled expression */ + int not; /**< do not match */ }; /** - * struct RxList - List of regular expressions + * struct RegexList - List of regular expressions */ -struct RxList +struct RegexList { - struct Regex *rx; - struct RxList *next; + struct Regex *regex; + struct RegexList *next; }; /** @@ -64,7 +64,7 @@ struct RxList */ struct ReplaceList { - struct Regex *rx; + struct Regex *regex; int nmatch; char *template; struct ReplaceList *next; diff --git a/muttlib.c b/muttlib.c index 6262f8698..83ef8423f 100644 --- a/muttlib.c +++ b/muttlib.c @@ -118,14 +118,14 @@ void mutt_adv_mktemp(char *s, size_t l) } } -int mutt_remove_from_rx_list(struct RxList **l, const char *str) +int mutt_remove_from_regex_list(struct RegexList **l, const char *str) { - struct RxList *p = NULL, *last = NULL; + struct RegexList *p = NULL, *last = NULL; int rv = -1; if (mutt_strcmp("*", str) == 0) { - mutt_free_rx_list(l); /* ``unCMD *'' means delete all current entries */ + mutt_free_regex_list(l); /* ``unCMD *'' means delete all current entries */ rv = 0; } else @@ -134,9 +134,9 @@ int mutt_remove_from_rx_list(struct RxList **l, const char *str) last = NULL; while (p) { - if (mutt_strcasecmp(str, p->rx->pattern) == 0) + if (mutt_strcasecmp(str, p->regex->pattern) == 0) { - mutt_free_regexp(&p->rx); + mutt_free_regexp(&p->regex); if (last) last->next = p->next; else @@ -189,7 +189,7 @@ char *mutt_expand_path(char *s, size_t slen) return _mutt_expand_path(s, slen, 0); } -char *_mutt_expand_path(char *s, size_t slen, int rx) +char *_mutt_expand_path(char *s, size_t slen, int regex) { char p[_POSIX_PATH_MAX] = ""; char q[_POSIX_PATH_MAX] = ""; @@ -340,9 +340,9 @@ char *_mutt_expand_path(char *s, size_t slen, int rx) } } - if (rx && *p && !recurse) + if (regex && *p && !recurse) { - mutt_rx_sanitize_string(q, sizeof(q), p); + mutt_regex_sanitize_string(q, sizeof(q), p); snprintf(tmp, sizeof(tmp), "%s%s", q, tail); } else @@ -380,9 +380,9 @@ char *mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw) memset(dest, 0, destlen); - if (GecosMask.rx) + if (GecosMask.regex) { - if (regexec(GecosMask.rx, pw->pw_gecos, 1, pat_match, 0) == 0) + if (regexec(GecosMask.regex, pw->pw_gecos, 1, pat_match, 0) == 0) strfcpy(dest, pw->pw_gecos + pat_match[0].rm_so, MIN(pat_match[0].rm_eo - pat_match[0].rm_so + 1, destlen)); } @@ -856,13 +856,13 @@ char *mutt_apply_replace(char *dbuf, size_t dlen, char *sbuf, struct ReplaceList nmatch = l->nmatch; } - if (regexec(l->rx->rx, src, l->nmatch, pmatch, 0) == 0) + if (regexec(l->regex->regex, src, l->nmatch, pmatch, 0) == 0) { tlen = 0; switcher ^= 1; dst = twinbuf[switcher]; - mutt_debug(5, "mutt_apply_replace: %s matches %s\n", src, l->rx->pattern); + mutt_debug(5, "mutt_apply_replace: %s matches %s\n", src, l->regex->pattern); /* Copy into other twinbuf with substitutions */ if (l->template) @@ -1581,8 +1581,8 @@ struct Regex *mutt_compile_regexp(const char *s, int flags) { struct Regex *pp = safe_calloc(1, sizeof(struct Regex)); pp->pattern = safe_strdup(s); - pp->rx = safe_calloc(1, sizeof(regex_t)); - if (REGCOMP(pp->rx, NONULL(s), flags) != 0) + pp->regex = safe_calloc(1, sizeof(regex_t)); + if (REGCOMP(pp->regex, NONULL(s), flags) != 0) mutt_free_regexp(&pp); return pp; @@ -1591,14 +1591,14 @@ struct Regex *mutt_compile_regexp(const char *s, int flags) void mutt_free_regexp(struct Regex **pp) { FREE(&(*pp)->pattern); - regfree((*pp)->rx); - FREE(&(*pp)->rx); + regfree((*pp)->regex); + FREE(&(*pp)->regex); FREE(pp); } -void mutt_free_rx_list(struct RxList **list) +void mutt_free_regex_list(struct RegexList **list) { - struct RxList *p = NULL; + struct RegexList *p = NULL; if (!list) return; @@ -1606,7 +1606,7 @@ void mutt_free_rx_list(struct RxList **list) { p = *list; *list = (*list)->next; - mutt_free_regexp(&p->rx); + mutt_free_regexp(&p->regex); FREE(&p); } } @@ -1621,22 +1621,22 @@ void mutt_free_replace_list(struct ReplaceList **list) { p = *list; *list = (*list)->next; - mutt_free_regexp(&p->rx); + mutt_free_regexp(&p->regex); FREE(&p->template); FREE(&p); } } -bool mutt_match_rx_list(const char *s, struct RxList *l) +bool mutt_match_regex_list(const char *s, struct RegexList *l) { if (!s) return false; for (; l; l = l->next) { - if (regexec(l->rx->rx, s, (size_t) 0, (regmatch_t *) 0, (int) 0) == 0) + if (regexec(l->regex->regex, s, (size_t) 0, (regmatch_t *) 0, (int) 0) == 0) { - mutt_debug(5, "mutt_match_rx_list: %s matches %s\n", s, l->rx->pattern); + mutt_debug(5, "mutt_match_regex_list: %s matches %s\n", s, l->regex->pattern); return true; } } @@ -1678,10 +1678,10 @@ bool mutt_match_spam_list(const char *s, struct ReplaceList *l, char *text, int } /* Does this pattern match? */ - if (regexec(l->rx->rx, s, (size_t) l->nmatch, (regmatch_t *) pmatch, (int) 0) == 0) + if (regexec(l->regex->regex, s, (size_t) l->nmatch, (regmatch_t *) pmatch, (int) 0) == 0) { - mutt_debug(5, "mutt_match_spam_list: %s matches %s\n", s, l->rx->pattern); - mutt_debug(5, "mutt_match_spam_list: %d subs\n", (int) l->rx->rx->re_nsub); + mutt_debug(5, "mutt_match_spam_list: %s matches %s\n", s, l->regex->pattern); + mutt_debug(5, "mutt_match_spam_list: %d subs\n", (int) l->regex->regex->re_nsub); /* Copy template into text, with substitutions. */ for (p = l->template; *p && tlen < textsize - 1;) diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 8dd89a047..34a9be676 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -201,7 +201,7 @@ static int pgp_copy_checksig(FILE *fpin, FILE *fpout) while ((line = mutt_read_line(line, &linelen, fpin, &lineno, 0)) != NULL) { - if (regexec(PgpGoodSign.rx, line, 0, NULL, 0) == 0) + if (regexec(PgpGoodSign.regex, line, 0, NULL, 0) == 0) { mutt_debug(2, "pgp_copy_checksig: \"%s\" matches regexp.\n", line); rv = 0; @@ -245,7 +245,7 @@ static int pgp_check_decryption_okay(FILE *fpin) while ((line = mutt_read_line(line, &linelen, fpin, &lineno, 0)) != NULL) { - if (regexec(PgpDecryptionOkay.rx, line, 0, NULL, 0) == 0) + if (regexec(PgpDecryptionOkay.regex, line, 0, NULL, 0) == 0) { mutt_debug(2, "pgp_check_decryption_okay: \"%s\" matches regexp.\n", line); rv = 0; diff --git a/pager.c b/pager.c index 709f75f6d..71ab791b3 100644 --- a/pager.c +++ b/pager.c @@ -796,7 +796,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, { for (color_line = ColorHdrList; color_line; color_line = color_line->next) { - if (REGEXEC(color_line->rx, buf) == 0) + if (REGEXEC(color_line->regex, buf) == 0) { line_info[n].type = MT_COLOR_HEADER; line_info[n].syntax[0].color = color_line->pair; @@ -847,9 +847,9 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, } else if (check_sig(buf, line_info, n - 1) == 0) line_info[n].type = MT_COLOR_SIGNATURE; - else if (regexec((regex_t *) QuoteRegexp.rx, buf, 1, pmatch, 0) == 0) + else if (regexec((regex_t *) QuoteRegexp.regex, buf, 1, pmatch, 0) == 0) { - if (regexec((regex_t *) Smileys.rx, buf, 1, smatch, 0) == 0) + if (regexec((regex_t *) Smileys.regex, buf, 1, smatch, 0) == 0) { if (smatch[0].rm_so > 0) { @@ -859,7 +859,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, c = buf[smatch[0].rm_so]; buf[smatch[0].rm_so] = 0; - if (regexec((regex_t *) QuoteRegexp.rx, buf, 1, pmatch, 0) == 0) + if (regexec((regex_t *) QuoteRegexp.regex, buf, 1, pmatch, 0) == 0) { if (q_classify && line_info[n].quote == NULL) line_info[n].quote = classify_quote(quote_list, buf + pmatch[0].rm_so, @@ -914,7 +914,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, color_line = ColorBodyList; while (color_line) { - if (regexec(&color_line->rx, buf + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0) + if (regexec(&color_line->regex, buf + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0) { if (pmatch[0].rm_eo != pmatch[0].rm_so) { @@ -982,7 +982,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, null_rx = false; for (color_line = ColorAttachList; color_line; color_line = color_line->next) { - if (regexec(&color_line->rx, buf + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0) + if (regexec(&color_line->regex, buf + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0) { if (pmatch[0].rm_eo != pmatch[0].rm_so) { @@ -1488,7 +1488,7 @@ static int display_line(FILE *f, LOFF_T *last_pos, struct Line **line_info, (*last)--; goto out; } - if (regexec((regex_t *) QuoteRegexp.rx, (char *) fmt, 1, pmatch, 0) != 0) + if (regexec((regex_t *) QuoteRegexp.regex, (char *) fmt, 1, pmatch, 0) != 0) goto out; (*line_info)[n].quote = classify_quote(quote_list, (char *) fmt + pmatch[0].rm_so, diff --git a/parse.c b/parse.c index 0de675d25..397f023e7 100644 --- a/parse.c +++ b/parse.c @@ -1197,7 +1197,7 @@ struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr, if (mutt_match_spam_list(line, SpamList, buf, sizeof(buf))) { - if (!mutt_match_rx_list(line, NoSpamList)) + if (!mutt_match_regex_list(line, NoSpamList)) { /* if spam tag already exists, figure out how to amend it */ if (e->spam && *buf) @@ -1267,7 +1267,7 @@ struct Envelope *mutt_read_rfc822_header(FILE *f, struct Header *hdr, rfc2047_decode(&e->subject); - if (regexec(ReplyRegexp.rx, e->subject, 1, pmatch, 0) == 0) + if (regexec(ReplyRegexp.regex, e->subject, 1, pmatch, 0) == 0) e->real_subj = e->subject + pmatch[0].rm_eo; else e->real_subj = e->subject; @@ -1337,7 +1337,7 @@ static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, b dflt ? "[OK] " : "[EXCL] ", b->type, b->subtype ? b->subtype : "*", a->major, a->minor, a->major_int); if ((a->major_int == TYPEANY || a->major_int == b->type) && - (!b->subtype || !regexec(&a->minor_rx, b->subtype, 0, NULL, 0))) + (!b->subtype || !regexec(&a->minor_regex, b->subtype, 0, NULL, 0))) { mutt_debug(5, "yes\n"); return true; diff --git a/pattern.c b/pattern.c index 984d1fa5e..773f5266b 100644 --- a/pattern.c +++ b/pattern.c @@ -112,14 +112,14 @@ static bool eat_regexp(struct Pattern *pat, struct Buffer *s, struct Buffer *err } else { - pat->p.rx = safe_malloc(sizeof(regex_t)); - r = REGCOMP(pat->p.rx, buf.data, REG_NEWLINE | REG_NOSUB | mutt_which_case(buf.data)); + pat->p.regex = safe_malloc(sizeof(regex_t)); + r = REGCOMP(pat->p.regex, buf.data, REG_NEWLINE | REG_NOSUB | mutt_which_case(buf.data)); if (r) { - regerror(r, pat->p.rx, errmsg, sizeof(errmsg)); + regerror(r, pat->p.regex, errmsg, sizeof(errmsg)); mutt_buffer_printf(err, "'%s': %s", buf.data, errmsg); FREE(&buf.data); - FREE(&pat->p.rx); + FREE(&pat->p.regex); return false; } FREE(&buf.data); @@ -920,7 +920,7 @@ static int patmatch(const struct Pattern *pat, const char *buf) else if (pat->groupmatch) return !mutt_group_match(pat->p.g, buf); else - return regexec(pat->p.rx, buf, 0, NULL, 0); + return regexec(pat->p.regex, buf, 0, NULL, 0); } static int msg_search(struct Context *ctx, struct Pattern *pat, int msgno) @@ -1117,10 +1117,10 @@ void mutt_pattern_free(struct Pattern **pat) FREE(&tmp->p.str); else if (tmp->groupmatch) tmp->p.g = NULL; - else if (tmp->p.rx) + else if (tmp->p.regex) { - regfree(tmp->p.rx); - FREE(&tmp->p.rx); + regfree(tmp->p.regex); + FREE(&tmp->p.regex); } if (tmp->child) diff --git a/pattern.h b/pattern.h index ea17b7ab2..7e64e36f4 100644 --- a/pattern.h +++ b/pattern.h @@ -50,7 +50,7 @@ struct Pattern struct Pattern *next; struct Pattern *child; /**< arguments to logical op */ union { - regex_t *rx; + regex_t *regex; struct Group *g; char *str; } p; diff --git a/protos.h b/protos.h index 674b8a8a6..6cbd3a8d2 100644 --- a/protos.h +++ b/protos.h @@ -46,7 +46,7 @@ struct Header; struct Parameter; struct Regex; struct ReplaceList; -struct RxList; +struct RegexList; struct State; struct ListHead; @@ -128,7 +128,7 @@ const char *mutt_attach_fmt(char *dest, size_t destlen, size_t col, int cols, char *mutt_charset_hook(const char *chs); char *mutt_iconv_hook(const char *chs); char *mutt_expand_path(char *s, size_t slen); -char *_mutt_expand_path(char *s, size_t slen, int rx); +char *_mutt_expand_path(char *s, size_t slen, int regex); char *mutt_find_hook(int type, const char *pat); char *mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw); char *mutt_get_body_charset(char *d, size_t dlen, struct Body *b); @@ -241,7 +241,7 @@ void mutt_update_encoding(struct Body *a); void mutt_version(void); void mutt_view_attachments(struct Header *hdr); void mutt_write_address_list(struct Address *adr, FILE *fp, int linelen, int display); -int mutt_add_to_rx_list(struct RxList **list, const char *s, int flags, struct Buffer *err); +int mutt_add_to_regex_list(struct RegexList **list, const char *s, int flags, struct Buffer *err); bool mutt_addr_is_user(struct Address *addr); int mutt_addwch(wchar_t wc); int mutt_alias_complete(char *s, size_t buflen); @@ -307,7 +307,7 @@ bool mutt_is_message_type(int type, const char *subtype); bool mutt_is_subscribed_list(struct Address *addr); bool mutt_is_text_part(struct Body *b); int mutt_lookup_mime_type(struct Body *att, const char *path); -bool mutt_match_rx_list(const char *s, struct RxList *l); +bool mutt_match_regex_list(const char *s, struct RegexList *l); bool mutt_match_spam_list(const char *s, struct ReplaceList *l, char *text, int textsize); int mutt_multi_choice(char *prompt, char *letters); bool mutt_needs_mailcap(struct Body *m); diff --git a/send.c b/send.c index 82206d1d9..032ba8190 100644 --- a/send.c +++ b/send.c @@ -1269,7 +1269,7 @@ static int has_recips(struct Address *a) static int search_attach_keyword(char *filename) { /* Search for the regex in AttachKeyword within a file */ - if (!AttachKeyword.rx) + if (!AttachKeyword.regex) return 0; FILE *attf = safe_fopen(filename, "r"); @@ -1281,8 +1281,8 @@ static int search_attach_keyword(char *filename) while (!feof(attf)) { fgets(inputline, LONG_STRING, attf); - if (regexec(QuoteRegexp.rx, inputline, 0, NULL, 0) != 0 && - regexec(AttachKeyword.rx, inputline, 0, NULL, 0) == 0) + if (regexec(QuoteRegexp.regex, inputline, 0, NULL, 0) != 0 && + regexec(AttachKeyword.regex, inputline, 0, NULL, 0) == 0) { found = 1; break;