From: Pietro Cerutti Date: Fri, 25 May 2018 09:44:54 +0000 (+0000) Subject: Rename Group-related structures X-Git-Tag: 2019-10-25~442^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=39297ac9c827bb779d9f6782b743e82351fd6fa0;p=neomutt Rename Group-related structures --- diff --git a/group.c b/group.c index 87ea2cddc..8b8ed4c6d 100644 --- a/group.c +++ b/group.c @@ -78,13 +78,13 @@ static void group_remove(struct Group *g) } /** - * mutt_group_context_clear - Empty a Group List - * @param head Group List to modify + * mutt_group_context_clear - Clear a GroupList + * @param head GroupList to clear * @retval 0 Always */ -int mutt_group_context_clear(struct GroupContextHead *head) +int mutt_group_context_clear(struct GroupList *head) { - struct GroupContext *np = STAILQ_FIRST(head), *next = NULL; + struct GroupNode *np = STAILQ_FIRST(head), *next = NULL; while (np) { group_remove(np->g); @@ -109,30 +109,30 @@ static bool empty_group(struct Group *g) } /** - * mutt_group_context_add - Add a Group to a List - * @param head Group List + * mutt_group_context_add - Add a Group to a GroupList + * @param head GroupList to add to * @param group Group to add */ -void mutt_group_context_add(struct GroupContextHead *head, struct Group *group) +void mutt_group_context_add(struct GroupList *head, struct Group *group) { - struct GroupContext *np = NULL; + struct GroupNode *np = NULL; STAILQ_FOREACH(np, head, entries) { if (np->g == group) return; } - np = mutt_mem_calloc(1, sizeof(struct GroupContext)); + np = mutt_mem_calloc(1, sizeof(struct GroupNode)); np->g = group; STAILQ_INSERT_TAIL(head, np, entries); } /** - * mutt_group_context_destroy - Destroy a Group List - * @param head Group List to destroy + * mutt_group_context_destroy - Free a GroupList + * @param head GroupList to free */ -void mutt_group_context_destroy(struct GroupContextHead *head) +void mutt_group_context_destroy(struct GroupList *head) { - struct GroupContext *np = STAILQ_FIRST(head), *next = NULL; + struct GroupNode *np = STAILQ_FIRST(head), *next = NULL; while (np) { next = STAILQ_NEXT(np, entries); @@ -213,13 +213,13 @@ static int group_remove_regex(struct Group *g, const char *s) } /** - * mutt_group_context_add_addrlist - Add an Address List to a Group List - * @param head Group List to add to - * @param a Address List to add + * mutt_group_context_add_addrlist - Add Address list to a GroupList + * @param head GroupList to add to + * @param a Address to add */ -void mutt_group_context_add_addrlist(struct GroupContextHead *head, struct Address *a) +void mutt_group_context_add_addrlist(struct GroupList *head, struct Address *a) { - struct GroupContext *np = NULL; + struct GroupNode *np = NULL; STAILQ_FOREACH(np, head, entries) { group_add_addrlist(np->g, a); @@ -227,16 +227,16 @@ void mutt_group_context_add_addrlist(struct GroupContextHead *head, struct Addre } /** - * mutt_group_context_remove_addrlist - Remove an Address List from a Group List - * @param head Group List to modify - * @param a Address List to remove + * mutt_group_context_remove_addrlist - Remove Address from a GroupList + * @param head GroupList to remove from + * @param a Address to remove * @retval 0 Success * @retval -1 Error */ -int mutt_group_context_remove_addrlist(struct GroupContextHead *head, struct Address *a) +int mutt_group_context_remove_addrlist(struct GroupList *head, struct Address *a) { int rc = 0; - struct GroupContext *np = NULL; + struct GroupNode *np = NULL; STAILQ_FOREACH(np, head, entries) { @@ -250,20 +250,20 @@ int mutt_group_context_remove_addrlist(struct GroupContextHead *head, struct Add } /** - * mutt_group_context_add_regex - Add a Regex to a Group List - * @param head Group List to add to - * @param s Regex string to add + * mutt_group_context_add_regex - Add matching Addresses to a GroupList + * @param head GroupList to add to + * @param s Address to match * @param flags Flags, e.g. REG_ICASE * @param err Buffer for error message * @retval 0 Success * @retval -1 Error */ -int mutt_group_context_add_regex(struct GroupContextHead *head, const char *s, +int mutt_group_context_add_regex(struct GroupList *head, const char *s, int flags, struct Buffer *err) { int rc = 0; - struct GroupContext *np = NULL; + struct GroupNode *np = NULL; STAILQ_FOREACH(np, head, entries) { rc = group_add_regex(np->g, s, flags, err); @@ -274,16 +274,16 @@ int mutt_group_context_add_regex(struct GroupContextHead *head, const char *s, } /** - * mutt_group_context_remove_regex - Remove a Regex from a Group List - * @param head Group List to modify - * @param s Regex string to remove + * mutt_group_context_remove_regex - Remove matching addresses from a GroupList + * @param head GroupList to remove from + * @param s Address to match * @retval 0 Success * @retval -1 Error */ -int mutt_group_context_remove_regex(struct GroupContextHead *head, const char *s) +int mutt_group_context_remove_regex(struct GroupList *head, const char *s) { int rc = 0; - struct GroupContext *np = NULL; + struct GroupNode *np = NULL; STAILQ_FOREACH(np, head, entries) { rc = group_remove_regex(np->g, s); diff --git a/group.h b/group.h index b2027b7c9..a36854e6f 100644 --- a/group.h +++ b/group.h @@ -43,27 +43,27 @@ struct Group }; /** - * struct GroupContext - A set of Groups + * struct GroupNode - A node in a GroupNode */ -struct GroupContext +struct GroupNode { struct Group *g; - STAILQ_ENTRY(GroupContext) entries; + STAILQ_ENTRY(GroupNode) entries; }; -STAILQ_HEAD(GroupContextHead, GroupContext); +STAILQ_HEAD(GroupList, GroupNode); -void mutt_group_context_add(struct GroupContextHead *head, struct Group *group); -void mutt_group_context_destroy(struct GroupContextHead *head); -void mutt_group_context_add_addrlist(struct GroupContextHead *head, struct Address *a); -int mutt_group_context_add_regex(struct GroupContextHead *head, const char *s, +void mutt_group_context_add(struct GroupList *head, struct Group *group); +void mutt_group_context_destroy(struct GroupList *head); +void mutt_group_context_add_addrlist(struct GroupList *head, struct Address *a); +int mutt_group_context_add_regex(struct GroupList *head, const char *s, int flags, struct Buffer *err); bool mutt_group_match(struct Group *g, const char *s); -int mutt_group_context_clear(struct GroupContextHead *head); -int mutt_group_context_remove_regex(struct GroupContextHead *head, const char *s); -int mutt_group_context_remove_addrlist(struct GroupContextHead *head, struct Address *a); +int mutt_group_context_clear(struct GroupList *head); +int mutt_group_context_remove_regex(struct GroupList *head, const char *s); +int mutt_group_context_remove_addrlist(struct GroupList *head, struct Address *a); struct Group *mutt_pattern_group(const char *k); diff --git a/init.c b/init.c index 4aa269de0..9dea765cd 100644 --- a/init.c +++ b/init.c @@ -532,7 +532,7 @@ static int parse_attach_list(struct Buffer *buf, struct Buffer *s, /** * parse_group_context - Parse a group context - * @param ctx GroupContext to add to + * @param ctx GroupList to add to * @param buf Temporary Buffer space * @param s Buffer containing string to be parsed * @param data Flags associated with the command @@ -540,7 +540,7 @@ static int parse_attach_list(struct Buffer *buf, struct Buffer *s, * @retval 0 Success * @retval -1 Error */ -static int parse_group_context(struct GroupContextHead *ctx, struct Buffer *buf, +static int parse_group_context(struct GroupList *ctx, struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err) { while (mutt_str_strcasecmp(buf->data, "-group") == 0) @@ -893,7 +893,7 @@ static int parse_alias(struct Buffer *buf, struct Buffer *s, unsigned long data, { struct Alias *tmp = NULL; char *estr = NULL; - struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc); + struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc); if (!MoreArgs(s)) { @@ -972,7 +972,7 @@ bail: static int parse_alternates(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err) { - struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc); + struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc); alternates_clean(); @@ -1105,7 +1105,7 @@ static int parse_finish(struct Buffer *buf, struct Buffer *s, static int parse_group(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err) { - struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc); + struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc); enum GroupState state = GS_NONE; struct Address *addr = NULL; char *estr = NULL; @@ -1294,7 +1294,7 @@ static int parse_ignore(struct Buffer *buf, struct Buffer *s, static int parse_lists(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err) { - struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc); + struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc); do { @@ -1969,7 +1969,7 @@ static int parse_subjectrx_list(struct Buffer *buf, struct Buffer *s, static int parse_subscribe(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err) { - struct GroupContextHead gc = STAILQ_HEAD_INITIALIZER(gc); + struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc); do { diff --git a/init.h b/init.h index 2c3f06a61..4f24f950d 100644 --- a/init.h +++ b/init.h @@ -4709,7 +4709,7 @@ static int parse_unsubscribe (struct Buffer *buf, struct Buffer *s, unsigned static int parse_unsubscribe_from(struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); #endif /* Parse -group arguments */ -static int parse_group_context (struct GroupContextHead *ctx, +static int parse_group_context (struct GroupList *ctx, struct Buffer *buf, struct Buffer *s, unsigned long data, struct Buffer *err); const struct Command Commands[] = {