From 23172f98f041467695b4962758970b17402041ea Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 15 May 2017 14:50:07 +0100 Subject: [PATCH] replace 'REGEXP' with 'struct Regex' --- globals.h | 6 +++--- hook.c | 2 +- init.c | 16 ++++++++-------- mutt.h | 4 ++-- mutt_regex.h | 14 +++++++------- muttlib.c | 6 +++--- protos.h | 4 ++-- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/globals.h b/globals.h index df385caf6..70fc300fe 100644 --- a/globals.h +++ b/globals.h @@ -41,7 +41,7 @@ WHERE char *Attribution; WHERE char *AttributionLocale; WHERE char *AttachCharset; WHERE char *AttachFormat; -WHERE REGEXP AttachKeyword; +WHERE struct Regex AttachKeyword; WHERE char *Charset; WHERE char *ComposeFormat; WHERE char *ConfigCharset; @@ -280,8 +280,8 @@ WHERE struct Alias *Aliases INITVAL(0); WHERE struct List *UserHeader INITVAL(0); /* -- formerly in pgp.h -- */ -WHERE REGEXP PgpGoodSign; -WHERE REGEXP PgpDecryptionOkay; +WHERE struct Regex PgpGoodSign; +WHERE struct Regex PgpDecryptionOkay; WHERE char *PgpSignAs; WHERE short PgpTimeout; WHERE char *PgpEntryFormat; diff --git a/hook.c b/hook.c index bfa4aa537..f99c595b6 100644 --- a/hook.c +++ b/hook.c @@ -31,7 +31,7 @@ typedef struct hook { int type; /* hook type */ - REGEXP rx; /* regular expression */ + struct Regex rx; /* regular expression */ char *command; /* filename, command or pattern to execute */ struct Pattern *pattern; /* used for fcc,save,send-hook */ struct hook *next; diff --git a/init.c b/init.c index 5a269d933..fa92a20d5 100644 --- a/init.c +++ b/init.c @@ -124,7 +124,7 @@ static int parse_regex(int idx, struct Buffer *tmp, struct Buffer *err) int e, flags = 0; const char *p = NULL; regex_t *rx = NULL; - REGEXP *ptr = (REGEXP *) MuttVars[idx].data; + struct Regex *ptr = (struct Regex *) MuttVars[idx].data; if (!ptr->pattern || (mutt_strcmp(ptr->pattern, tmp->data) != 0)) { @@ -479,7 +479,7 @@ int mutt_option_set(const struct option_t *val, struct Buffer *err) static void free_opt(struct option_t *p) { - REGEXP *pp = NULL; + struct Regex *pp = NULL; switch (p->type & DT_MASK) { @@ -487,7 +487,7 @@ static void free_opt(struct option_t *p) rfc822_free_address((struct Address **) p->data); break; case DT_RX: - pp = (REGEXP *) p->data; + pp = (struct Regex *) p->data; FREE(&pp->pattern); if (pp->rx) { @@ -562,7 +562,7 @@ static RX_LIST *new_rx_list(void) int mutt_add_to_rx_list(RX_LIST **list, const char *s, int flags, struct Buffer *err) { RX_LIST *t = NULL, *last = NULL; - REGEXP *rx = NULL; + struct Regex *rx = NULL; if (!s || !*s) return 0; @@ -650,7 +650,7 @@ static int add_to_replace_list(REPLACE_LIST **list, const char *pat, const char *templ, struct Buffer *err) { REPLACE_LIST *t = NULL, *last = NULL; - REGEXP *rx = NULL; + struct Regex *rx = NULL; int n; const char *p = NULL; @@ -1892,7 +1892,7 @@ static void set_default(struct option_t *p) break; case DT_RX: { - REGEXP *pp = (REGEXP *) p->data; + struct Regex *pp = (struct Regex *) p->data; if (!p->init && pp->pattern) p->init = (unsigned long) safe_strdup(pp->pattern); break; @@ -1954,7 +1954,7 @@ static void restore_default(struct option_t *p) break; case DT_RX: { - REGEXP *pp = (REGEXP *) p->data; + struct Regex *pp = (struct Regex *) p->data; int flags = 0; FREE(&pp->pattern); @@ -2601,7 +2601,7 @@ static int parse_set(struct Buffer *tmp, struct Buffer *s, unsigned long data, s if (query || *s->dptr != '=') { /* user requested the value of this variable */ - REGEXP *ptr = (REGEXP *) MuttVars[idx].data; + struct Regex *ptr = (struct Regex *) MuttVars[idx].data; pretty_var(err->data, err->dsize, MuttVars[idx].option, NONULL(ptr->pattern)); break; } diff --git a/mutt.h b/mutt.h index aeaff3a9c..201eabbf5 100644 --- a/mutt.h +++ b/mutt.h @@ -603,13 +603,13 @@ struct List typedef struct rx_list_t { - REGEXP *rx; + struct Regex *rx; struct rx_list_t *next; } RX_LIST; typedef struct replace_list_t { - REGEXP *rx; + struct Regex *rx; int nmatch; char *template; struct replace_list_t *next; diff --git a/mutt_regex.h b/mutt_regex.h index 5b675d414..08b779bd3 100644 --- a/mutt_regex.h +++ b/mutt_regex.h @@ -34,17 +34,17 @@ #define REGCOMP(X, Y, Z) regcomp(X, Y, REG_WORDS | REG_EXTENDED | (Z)) #define REGEXEC(X, Y) regexec(&X, Y, (size_t) 0, (regmatch_t *) 0, (int) 0) -typedef struct +struct Regex { char *pattern; /* printable version */ regex_t *rx; /* compiled expression */ int not; /* do not match */ -} REGEXP; +}; -WHERE REGEXP Mask; -WHERE REGEXP QuoteRegexp; -WHERE REGEXP ReplyRegexp; -WHERE REGEXP Smileys; -WHERE REGEXP GecosMask; +WHERE struct Regex Mask; +WHERE struct Regex QuoteRegexp; +WHERE struct Regex ReplyRegexp; +WHERE struct Regex Smileys; +WHERE struct Regex GecosMask; #endif /* _MUTT_REGEX_H */ diff --git a/muttlib.c b/muttlib.c index db82584b8..4e9f6c12b 100644 --- a/muttlib.c +++ b/muttlib.c @@ -2007,9 +2007,9 @@ const char *mutt_make_version(void) return vstring; } -REGEXP *mutt_compile_regexp(const char *s, int flags) +struct Regex *mutt_compile_regexp(const char *s, int flags) { - REGEXP *pp = safe_calloc(sizeof(REGEXP), 1); + struct Regex *pp = safe_calloc(sizeof(struct Regex), 1); pp->pattern = safe_strdup(s); pp->rx = safe_calloc(sizeof(regex_t), 1); if (REGCOMP(pp->rx, NONULL(s), flags) != 0) @@ -2018,7 +2018,7 @@ REGEXP *mutt_compile_regexp(const char *s, int flags) return pp; } -void mutt_free_regexp(REGEXP **pp) +void mutt_free_regexp(struct Regex **pp) { FREE(&(*pp)->pattern); regfree((*pp)->rx); diff --git a/protos.h b/protos.h index 8fc87a106..7f0cfcef6 100644 --- a/protos.h +++ b/protos.h @@ -151,7 +151,7 @@ const char *mutt_fqdn(short may_hide_host); struct Group *mutt_pattern_group(const char *k); -REGEXP *mutt_compile_regexp(const char *s, int flags); +struct Regex *mutt_compile_regexp(const char *s, int flags); void mutt_account_hook(const char *url); void mutt_add_to_reference_headers(struct Envelope *env, struct Envelope *curenv, struct List ***pp, @@ -213,7 +213,7 @@ void mutt_free_enter_state(struct EnterState **esp); void mutt_free_envelope(struct Envelope **p); void mutt_free_header(struct Header **h); void mutt_free_parameter(struct Parameter **p); -void mutt_free_regexp(REGEXP **pp); +void mutt_free_regexp(struct Regex **pp); void mutt_help(int menu); void mutt_draw_tree(struct Context *ctx); void mutt_check_lookup_list(struct Body *b, char *type, int len); -- 2.49.0