From: Richard Russon Date: Mon, 15 May 2017 13:50:41 +0000 (+0100) Subject: replace 'REPLACE_LIST' with 'struct ReplaceList' X-Git-Tag: neomutt-20170526~21^2~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b37aa0bc02040f6c7217f0d860597643eed45e5;p=neomutt replace 'REPLACE_LIST' with 'struct ReplaceList' --- diff --git a/globals.h b/globals.h index 70fc300fe..3794e2a3b 100644 --- a/globals.h +++ b/globals.h @@ -207,9 +207,9 @@ WHERE RX_LIST *MailLists INITVAL(0); WHERE RX_LIST *UnMailLists INITVAL(0); WHERE RX_LIST *SubscribedLists INITVAL(0); WHERE RX_LIST *UnSubscribedLists INITVAL(0); -WHERE REPLACE_LIST *SpamList INITVAL(0); +WHERE struct ReplaceList *SpamList INITVAL(0); WHERE RX_LIST *NoSpamList INITVAL(0); -WHERE REPLACE_LIST *SubjectRxList INITVAL(0); +WHERE struct ReplaceList *SubjectRxList INITVAL(0); /* bit vector for boolean variables */ diff --git a/hcache/hcache.c b/hcache/hcache.c index 504e5005d..0c71304bd 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -728,7 +728,7 @@ header_cache_t *mutt_hcache_open(const char *path, const char *folder, hcache_na unsigned int intval; } digest; struct md5_ctx ctx; - REPLACE_LIST *spam = NULL; + struct ReplaceList *spam = NULL; RX_LIST *nospam = NULL; hcachever = HCACHEVER; diff --git a/init.c b/init.c index fa92a20d5..4aebb4394 100644 --- a/init.c +++ b/init.c @@ -604,9 +604,9 @@ int mutt_add_to_rx_list(RX_LIST **list, const char *s, int flags, struct Buffer return 0; } -static int remove_from_replace_list(REPLACE_LIST **list, const char *pat) +static int remove_from_replace_list(struct ReplaceList **list, const char *pat) { - REPLACE_LIST *cur = NULL, *prev = NULL; + struct ReplaceList *cur = NULL, *prev = NULL; int nremoved = 0; /* Being first is a special case. */ @@ -641,15 +641,15 @@ static int remove_from_replace_list(REPLACE_LIST **list, const char *pat) return nremoved; } -static REPLACE_LIST *new_replace_list(void) +static struct ReplaceList *new_replace_list(void) { - return safe_calloc(1, sizeof(REPLACE_LIST)); + return safe_calloc(1, sizeof(struct ReplaceList)); } -static int add_to_replace_list(REPLACE_LIST **list, const char *pat, +static int add_to_replace_list(struct ReplaceList **list, const char *pat, const char *templ, struct Buffer *err) { - REPLACE_LIST *t = NULL, *last = NULL; + struct ReplaceList *t = NULL, *last = NULL; struct Regex *rx = NULL; int n; const char *p = NULL; @@ -682,7 +682,7 @@ static int add_to_replace_list(REPLACE_LIST **list, const char *pat, break; } - /* If t is set, it's pointing into an extant REPLACE_LIST* that we want to + /* If t is set, it's pointing into an extant ReplaceList* that we want to * update. Otherwise we want to make a new one to link at the list's end. */ if (!t) @@ -698,7 +698,7 @@ static int add_to_replace_list(REPLACE_LIST **list, const char *pat, else mutt_free_regexp(&rx); - /* Now t is the REPLACE_LIST* that we want to modify. It is prepared. */ + /* Now t is the ReplaceList* that we want to modify. It is prepared. */ t->template = safe_strdup(templ); /* Find highest match number in template string */ @@ -979,7 +979,7 @@ static int parse_unalternates(struct Buffer *buf, struct Buffer *s, unsigned lon static int parse_replace_list(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err) { - REPLACE_LIST **list = (REPLACE_LIST **) data; + struct ReplaceList **list = (struct ReplaceList **) data; struct Buffer templ; memset(&templ, 0, sizeof(templ)); @@ -1012,7 +1012,7 @@ static int parse_replace_list(struct Buffer *buf, struct Buffer *s, unsigned lon static int parse_unreplace_list(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err) { - REPLACE_LIST **list = (REPLACE_LIST **) data; + struct ReplaceList **list = (struct ReplaceList **) data; /* First token is a regexp. */ if (!MoreArgs(s)) diff --git a/mutt.h b/mutt.h index 201eabbf5..e3475bc45 100644 --- a/mutt.h +++ b/mutt.h @@ -607,13 +607,13 @@ typedef struct rx_list_t struct rx_list_t *next; } RX_LIST; -typedef struct replace_list_t +struct ReplaceList { struct Regex *rx; int nmatch; char *template; - struct replace_list_t *next; -} REPLACE_LIST; + struct ReplaceList *next; +}; static inline struct List *mutt_new_list(void) { @@ -622,7 +622,7 @@ static inline struct List *mutt_new_list(void) void mutt_free_list(struct List **list); void mutt_free_rx_list(RX_LIST **list); -void mutt_free_replace_list(REPLACE_LIST **list); +void mutt_free_replace_list(struct ReplaceList **list); struct List *mutt_copy_list(struct List *p); int mutt_matches_ignore(const char *s); bool mutt_matches_list(const char *s, struct List *t); diff --git a/muttlib.c b/muttlib.c index 4e9f6c12b..68b98ce4f 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1178,9 +1178,9 @@ void mutt_safe_path(char *s, size_t l, struct Address *a) /* Note this function uses a fixed size buffer of LONG_STRING and so * should only be used for visual modifications, such as disp_subj. */ -char *mutt_apply_replace(char *dbuf, size_t dlen, char *sbuf, REPLACE_LIST *rlist) +char *mutt_apply_replace(char *dbuf, size_t dlen, char *sbuf, struct ReplaceList *rlist) { - REPLACE_LIST *l = NULL; + struct ReplaceList *l = NULL; static regmatch_t *pmatch = NULL; static int nmatch = 0; static char twinbuf[2][LONG_STRING]; @@ -2041,9 +2041,9 @@ void mutt_free_rx_list(RX_LIST **list) } } -void mutt_free_replace_list(REPLACE_LIST **list) +void mutt_free_replace_list(struct ReplaceList **list) { - REPLACE_LIST *p = NULL; + struct ReplaceList *p = NULL; if (!list) return; @@ -2081,7 +2081,7 @@ bool mutt_match_rx_list(const char *s, RX_LIST *l) * * Returns true if the argument `s` matches a pattern in the spam list, otherwise * false. */ -bool mutt_match_spam_list(const char *s, REPLACE_LIST *l, char *text, int textsize) +bool mutt_match_spam_list(const char *s, struct ReplaceList *l, char *text, int textsize) { static regmatch_t *pmatch = NULL; static int nmatch = 0; diff --git a/protos.h b/protos.h index 7f0cfcef6..733c5a671 100644 --- a/protos.h +++ b/protos.h @@ -272,7 +272,7 @@ void mutt_alias_add_reverse(struct Alias *t); void mutt_alias_delete_reverse(struct Alias *t); int mutt_alloc_color(int fg, int bg); int mutt_any_key_to_continue(const char *s); -char *mutt_apply_replace(char *dbuf, size_t dlen, char *sbuf, REPLACE_LIST *rlist); +char *mutt_apply_replace(char *dbuf, size_t dlen, char *sbuf, struct ReplaceList *rlist); int mutt_buffy_check(int force); int mutt_buffy_notify(void); int mutt_builtin_editor(const char *path, struct Header *msg, struct Header *cur); @@ -335,7 +335,7 @@ bool mutt_is_text_part(struct Body *b); int mutt_link_threads(struct Header *cur, struct Header *last, struct Context *ctx); int mutt_lookup_mime_type(struct Body *att, const char *path); bool mutt_match_rx_list(const char *s, RX_LIST *l); -bool mutt_match_spam_list(const char *s, REPLACE_LIST *l, char *text, int textsize); +bool mutt_match_spam_list(const char *s, struct ReplaceList *l, char *text, int textsize); int mutt_messages_in_thread(struct Context *ctx, struct Header *hdr, int flag); int mutt_multi_choice(char *prompt, char *letters); bool mutt_needs_mailcap(struct Body *m);