]> granicus.if.org Git - neomutt/commitdiff
unify GroupList variable naming
authorRichard Russon <rich@flatcap.org>
Sat, 15 Jun 2019 19:48:33 +0000 (20:48 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 15 Jun 2019 20:35:04 +0000 (21:35 +0100)
address/group.c
address/group.h
init.c

index 799373eb5cfaef59b8e4afd9105935cc69509cb9..72ccb22375413931a3589dd3892fcb4a57e66f8f 100644 (file)
@@ -98,14 +98,14 @@ static void group_remove(struct Group *g)
 
 /**
  * mutt_grouplist_clear - Clear a GroupList
- * @param head GroupList to clear
+ * @param gl GroupList to clear
  */
-void mutt_grouplist_clear(struct GroupList *head)
+void mutt_grouplist_clear(struct GroupList *gl)
 {
-  if (!head)
+  if (!gl)
     return;
 
-  struct GroupNode *np = STAILQ_FIRST(head);
+  struct GroupNode *np = STAILQ_FIRST(gl);
   struct GroupNode *next = NULL;
   while (np)
   {
@@ -114,7 +114,7 @@ void mutt_grouplist_clear(struct GroupList *head)
     FREE(&np);
     np = next;
   }
-  STAILQ_INIT(head);
+  STAILQ_INIT(gl);
 }
 
 /**
@@ -131,35 +131,35 @@ static bool empty_group(struct Group *g)
 
 /**
  * mutt_grouplist_add - Add a Group to a GroupList
- * @param head  GroupList to add to
+ * @param gl    GroupList to add to
  * @param group Group to add
  */
-void mutt_grouplist_add(struct GroupList *head, struct Group *group)
+void mutt_grouplist_add(struct GroupList *gl, struct Group *group)
 {
-  if (!head || !group)
+  if (!gl || !group)
     return;
 
   struct GroupNode *np = NULL;
-  STAILQ_FOREACH(np, head, entries)
+  STAILQ_FOREACH(np, gl, entries)
   {
     if (np->group == group)
       return;
   }
   np = mutt_mem_calloc(1, sizeof(struct GroupNode));
   np->group = group;
-  STAILQ_INSERT_TAIL(head, np, entries);
+  STAILQ_INSERT_TAIL(gl, np, entries);
 }
 
 /**
  * mutt_grouplist_destroy - Free a GroupList
- * @param head GroupList to free
+ * @param gl GroupList to free
  */
-void mutt_grouplist_destroy(struct GroupList *head)
+void mutt_grouplist_destroy(struct GroupList *gl)
 {
-  if (!head)
+  if (!gl)
     return;
 
-  struct GroupNode *np = STAILQ_FIRST(head);
+  struct GroupNode *np = STAILQ_FIRST(gl);
   struct GroupNode *next = NULL;
   while (np)
   {
@@ -167,7 +167,7 @@ void mutt_grouplist_destroy(struct GroupList *head)
     FREE(&np);
     np = next;
   }
-  STAILQ_INIT(head);
+  STAILQ_INIT(gl);
 }
 
 /**
@@ -219,16 +219,16 @@ static int group_remove_regex(struct Group *g, const char *s)
 
 /**
  * mutt_grouplist_add_addrlist - Add Address list to a GroupList
- * @param head GroupList to add to
- * @param al   Address list to add
+ * @param gl GroupList to add to
+ * @param al Address list to add
  */
-void mutt_grouplist_add_addrlist(struct GroupList *head, struct AddressList *al)
+void mutt_grouplist_add_addrlist(struct GroupList *gl, struct AddressList *al)
 {
-  if (!head || !al)
+  if (!gl || !al)
     return;
 
   struct GroupNode *np = NULL;
-  STAILQ_FOREACH(np, head, entries)
+  STAILQ_FOREACH(np, gl, entries)
   {
     group_add_addrlist(np->group, al);
   }
@@ -236,18 +236,18 @@ void mutt_grouplist_add_addrlist(struct GroupList *head, struct AddressList *al)
 
 /**
  * mutt_grouplist_remove_addrlist - Remove an AddressList from a GroupList
- * @param head GroupList to remove from
- * @param al   AddressList to remove
+ * @param gl GroupList to remove from
+ * @param al AddressList to remove
  * @retval  0 Success
  * @retval -1 Error
  */
-int mutt_grouplist_remove_addrlist(struct GroupList *head, struct AddressList *al)
+int mutt_grouplist_remove_addrlist(struct GroupList *gl, struct AddressList *al)
 {
-  if (!head || !al)
+  if (!gl || !al)
     return -1;
 
   struct GroupNode *gnp = NULL;
-  STAILQ_FOREACH(gnp, head, entries)
+  STAILQ_FOREACH(gnp, gl, entries)
   {
     struct Address *a = NULL;
     TAILQ_FOREACH(a, al, entries)
@@ -265,23 +265,22 @@ int mutt_grouplist_remove_addrlist(struct GroupList *head, struct AddressList *a
 
 /**
  * mutt_grouplist_add_regex - Add matching Addresses to a GroupList
- * @param head  GroupList to add to
+ * @param gl    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_grouplist_add_regex(struct GroupList *head, const char *s, int flags,
-                             struct Buffer *err)
+int mutt_grouplist_add_regex(struct GroupList *gl, const char *s, int flags, struct Buffer *err)
 {
-  if (!head || !s)
+  if (!gl || !s)
     return -1;
 
   int rc = 0;
 
   struct GroupNode *np = NULL;
-  STAILQ_FOREACH(np, head, entries)
+  STAILQ_FOREACH(np, gl, entries)
   {
     rc = group_add_regex(np->group, s, flags, err);
     if (rc)
@@ -292,19 +291,19 @@ int mutt_grouplist_add_regex(struct GroupList *head, const char *s, int flags,
 
 /**
  * mutt_grouplist_remove_regex - Remove matching addresses from a GroupList
- * @param head GroupList to remove from
- * @param s    Address to match
+ * @param gl GroupList to remove from
+ * @param s  Address to match
  * @retval  0 Success
  * @retval -1 Error
  */
-int mutt_grouplist_remove_regex(struct GroupList *head, const char *s)
+int mutt_grouplist_remove_regex(struct GroupList *gl, const char *s)
 {
-  if (!head || !s)
+  if (!gl || !s)
     return -1;
 
   int rc = 0;
   struct GroupNode *np = NULL;
-  STAILQ_FOREACH(np, head, entries)
+  STAILQ_FOREACH(np, gl, entries)
   {
     rc = group_remove_regex(np->group, s);
     if (empty_group(np->group))
index 7a5c27107b75120a220f6f50deda485d44b45098..15208e4e8bdda131af8c3ce31465ef7ba71f676a 100644 (file)
@@ -54,14 +54,14 @@ STAILQ_HEAD(GroupList, GroupNode);
 
 void mutt_grouplist_init(void);
 void mutt_grouplist_free(void);
-void mutt_grouplist_add(struct GroupList *head, struct Group *group);
-void mutt_grouplist_add_addrlist(struct GroupList *head, struct AddressList *a);
-int  mutt_grouplist_add_regex(struct GroupList *head, const char *s,
+void mutt_grouplist_add(struct GroupList *gl, struct Group *group);
+void mutt_grouplist_add_addrlist(struct GroupList *gl, struct AddressList *a);
+int  mutt_grouplist_add_regex(struct GroupList *gl, const char *s,
                               int flags, struct Buffer *err);
-void mutt_grouplist_destroy(struct GroupList *head);
-void mutt_grouplist_clear(struct GroupList *head);
-int  mutt_grouplist_remove_regex(struct GroupList *head, const char *s);
-int  mutt_grouplist_remove_addrlist(struct GroupList *head, struct AddressList *a);
+void mutt_grouplist_destroy(struct GroupList *gl);
+void mutt_grouplist_clear(struct GroupList *gl);
+int  mutt_grouplist_remove_regex(struct GroupList *gl, const char *s);
+int  mutt_grouplist_remove_addrlist(struct GroupList *gl, struct AddressList *a);
 
 bool mutt_group_match(struct Group *g, const char *s);
 struct Group *mutt_pattern_group(const char *pat);
diff --git a/init.c b/init.c
index fc9cda3118f3b21ab70a6e94a0906179bb3d847a..c10d301584051b2b8b81c44b0931526f0dea3ece 100644 (file)
--- a/init.c
+++ b/init.c
@@ -531,7 +531,7 @@ static enum CommandResult parse_attach_list(struct Buffer *buf, struct Buffer *s
 
 /**
  * parse_grouplist - Parse a group context
- * @param ctx  GroupList to add to
+ * @param gl   GroupList to add to
  * @param buf  Temporary Buffer space
  * @param s    Buffer containing string to be parsed
  * @param data Flags associated with the command
@@ -539,7 +539,7 @@ static enum CommandResult parse_attach_list(struct Buffer *buf, struct Buffer *s
  * @retval  0 Success
  * @retval -1 Error
  */
-static int parse_grouplist(struct GroupList *ctx, struct Buffer *buf,
+static int parse_grouplist(struct GroupList *gl, struct Buffer *buf,
                            struct Buffer *s, unsigned long data, struct Buffer *err)
 {
   while (mutt_str_strcasecmp(buf->data, "-group") == 0)
@@ -552,7 +552,7 @@ static int parse_grouplist(struct GroupList *ctx, struct Buffer *buf,
 
     mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
 
-    mutt_grouplist_add(ctx, mutt_pattern_group(buf->data));
+    mutt_grouplist_add(gl, mutt_pattern_group(buf->data));
 
     if (!MoreArgs(s))
     {
@@ -890,7 +890,7 @@ static enum CommandResult parse_alias(struct Buffer *buf, struct Buffer *s,
 {
   struct Alias *tmp = NULL;
   char *estr = NULL;
-  struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+  struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
 
   if (!MoreArgs(s))
   {
@@ -900,7 +900,7 @@ static enum CommandResult parse_alias(struct Buffer *buf, struct Buffer *s,
 
   mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
 
-  if (parse_grouplist(&gc, buf, s, data, err) == -1)
+  if (parse_grouplist(&gl, buf, s, data, err) == -1)
     return MUTT_CMD_ERROR;
 
   /* check to see if an alias with this name already exists */
@@ -941,7 +941,7 @@ static enum CommandResult parse_alias(struct Buffer *buf, struct Buffer *s,
     goto bail;
   }
 
-  mutt_grouplist_add_addrlist(&gc, &tmp->addr);
+  mutt_grouplist_add_addrlist(&gl, &tmp->addr);
   mutt_alias_add_reverse(tmp);
 
   if (C_DebugLevel > LL_DEBUG4)
@@ -959,11 +959,11 @@ static enum CommandResult parse_alias(struct Buffer *buf, struct Buffer *s,
         mutt_debug(5, "  %s\n", a->mailbox);
     }
   }
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_SUCCESS;
 
 bail:
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_ERROR;
 }
 
@@ -973,7 +973,7 @@ bail:
 static enum CommandResult parse_alternates(struct Buffer *buf, struct Buffer *s,
                                            unsigned long data, struct Buffer *err)
 {
-  struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+  struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
 
   alternates_clean();
 
@@ -981,7 +981,7 @@ static enum CommandResult parse_alternates(struct Buffer *buf, struct Buffer *s,
   {
     mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
 
-    if (parse_grouplist(&gc, buf, s, data, err) == -1)
+    if (parse_grouplist(&gl, buf, s, data, err) == -1)
       goto bail;
 
     mutt_regexlist_remove(&UnAlternates, buf->data);
@@ -989,15 +989,15 @@ static enum CommandResult parse_alternates(struct Buffer *buf, struct Buffer *s,
     if (mutt_regexlist_add(&Alternates, buf->data, REG_ICASE, err) != 0)
       goto bail;
 
-    if (mutt_grouplist_add_regex(&gc, buf->data, REG_ICASE, err) != 0)
+    if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
       goto bail;
   } while (MoreArgs(s));
 
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_SUCCESS;
 
 bail:
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_ERROR;
 }
 
@@ -1107,18 +1107,18 @@ static enum CommandResult parse_finish(struct Buffer *buf, struct Buffer *s,
 static enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s,
                                       unsigned long data, struct Buffer *err)
 {
-  struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+  struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
   enum GroupState state = GS_NONE;
 
   do
   {
     mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
-    if (parse_grouplist(&gc, buf, s, data, err) == -1)
+    if (parse_grouplist(&gl, buf, s, data, err) == -1)
       goto bail;
 
     if ((data == MUTT_UNGROUP) && (mutt_str_strcasecmp(buf->data, "*") == 0))
     {
-      mutt_grouplist_clear(&gc);
+      mutt_grouplist_clear(&gl);
       goto out;
     }
 
@@ -1137,12 +1137,12 @@ static enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s,
 
         case GS_RX:
           if ((data == MUTT_GROUP) &&
-              (mutt_grouplist_add_regex(&gc, buf->data, REG_ICASE, err) != 0))
+              (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0))
           {
             goto bail;
           }
           else if ((data == MUTT_UNGROUP) &&
-                   (mutt_grouplist_remove_regex(&gc, buf->data) < 0))
+                   (mutt_grouplist_remove_regex(&gl, buf->data) < 0))
           {
             goto bail;
           }
@@ -1164,9 +1164,9 @@ static enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s,
             goto bail;
           }
           if (data == MUTT_GROUP)
-            mutt_grouplist_add_addrlist(&gc, &al);
+            mutt_grouplist_add_addrlist(&gl, &al);
           else if (data == MUTT_UNGROUP)
-            mutt_grouplist_remove_addrlist(&gc, &al);
+            mutt_grouplist_remove_addrlist(&gl, &al);
           mutt_addrlist_clear(&al);
           break;
         }
@@ -1175,15 +1175,15 @@ static enum CommandResult parse_group(struct Buffer *buf, struct Buffer *s,
   } while (MoreArgs(s));
 
 out:
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_SUCCESS;
 
 bail:
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_ERROR;
 
 warn:
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_WARNING;
 }
 
@@ -1281,13 +1281,13 @@ static enum CommandResult parse_ignore(struct Buffer *buf, struct Buffer *s,
 static enum CommandResult parse_lists(struct Buffer *buf, struct Buffer *s,
                                       unsigned long data, struct Buffer *err)
 {
-  struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+  struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
 
   do
   {
     mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
 
-    if (parse_grouplist(&gc, buf, s, data, err) == -1)
+    if (parse_grouplist(&gl, buf, s, data, err) == -1)
       goto bail;
 
     mutt_regexlist_remove(&UnMailLists, buf->data);
@@ -1295,15 +1295,15 @@ static enum CommandResult parse_lists(struct Buffer *buf, struct Buffer *s,
     if (mutt_regexlist_add(&MailLists, buf->data, REG_ICASE, err) != 0)
       goto bail;
 
-    if (mutt_grouplist_add_regex(&gc, buf->data, REG_ICASE, err) != 0)
+    if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
       goto bail;
   } while (MoreArgs(s));
 
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_SUCCESS;
 
 bail:
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_ERROR;
 }
 
@@ -2049,13 +2049,13 @@ static enum CommandResult parse_subjectrx_list(struct Buffer *buf, struct Buffer
 static enum CommandResult parse_subscribe(struct Buffer *buf, struct Buffer *s,
                                           unsigned long data, struct Buffer *err)
 {
-  struct GroupList gc = STAILQ_HEAD_INITIALIZER(gc);
+  struct GroupList gl = STAILQ_HEAD_INITIALIZER(gl);
 
   do
   {
     mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS);
 
-    if (parse_grouplist(&gc, buf, s, data, err) == -1)
+    if (parse_grouplist(&gl, buf, s, data, err) == -1)
       goto bail;
 
     mutt_regexlist_remove(&UnMailLists, buf->data);
@@ -2065,15 +2065,15 @@ static enum CommandResult parse_subscribe(struct Buffer *buf, struct Buffer *s,
       goto bail;
     if (mutt_regexlist_add(&SubscribedLists, buf->data, REG_ICASE, err) != 0)
       goto bail;
-    if (mutt_grouplist_add_regex(&gc, buf->data, REG_ICASE, err) != 0)
+    if (mutt_grouplist_add_regex(&gl, buf->data, REG_ICASE, err) != 0)
       goto bail;
   } while (MoreArgs(s));
 
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_SUCCESS;
 
 bail:
-  mutt_grouplist_destroy(&gc);
+  mutt_grouplist_destroy(&gl);
   return MUTT_CMD_ERROR;
 }