]> granicus.if.org Git - neomutt/commitdiff
unify new/free() functions 2
authorRichard Russon <rich@flatcap.org>
Sat, 31 Aug 2019 13:45:55 +0000 (14:45 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 1 Sep 2019 16:37:02 +0000 (17:37 +0100)
'Free' functions:
- Name ends in `_free()`
- Take a `**ptr`
- Creates a native pointer
- Sets pointer to `NULL`

Functions changed:
- color_line_free()
- mutt_actx_free()
- mutt_attachmatch_free()
- mutt_autocrypthdr_free()
- mutt_autocrypt_db_account_free()
- mutt_autocrypt_db_gossip_history_free()
- mutt_autocrypt_db_peer_free()
- mutt_autocrypt_db_peer_history_free()

'New' functions:
- Name ends in `_new()`
- Must be a 'new' function if there's a 'free' function

Functions changed:
- class_color_new()
- color_line_new()
- hash_new()
- mutt_actx_new()
- mutt_attachmatch_new()
- mutt_autocrypthdr_new()
- parameter_new()
- pgp_keyinfo_new()

17 files changed:
autocrypt/autocrypt.c
autocrypt/autocrypt_db.c
autocrypt/autocrypt_private.h
color.c
compose.c
email/attach.c
email/attach.h
email/envelope.c
email/envelope.h
email/parse.c
email/rfc2231.c
init.c
mutt/hash.c
ncrypt/pgplib.c
ncrypt/pgplib.h
pager.c
recvattach.c

index ede2a8fd4af0a360eee569ea2f8ffcd8b5d7e1d5..cc5e1b94efc40863aed3dfed3edab5bd0237ecdc 100644 (file)
@@ -808,7 +808,7 @@ int mutt_autocrypt_generate_gossip_list(struct Email *e)
   struct Envelope *mime_headers = e->content->mime_headers;
   if (!mime_headers)
     mime_headers = e->content->mime_headers = mutt_env_new();
-  mutt_free_autocrypthdr(&mime_headers->autocrypt_gossip);
+  mutt_autocrypthdr_free(&mime_headers->autocrypt_gossip);
 
   struct AddressList recips = TAILQ_HEAD_INITIALIZER(recips);
 
@@ -829,7 +829,7 @@ int mutt_autocrypt_generate_gossip_list(struct Email *e)
 
     if (keydata)
     {
-      struct AutocryptHeader *gossip = mutt_new_autocrypthdr();
+      struct AutocryptHeader *gossip = mutt_autocrypthdr_new();
       gossip->addr = mutt_str_strdup(peer->email_addr);
       gossip->keydata = mutt_str_strdup(keydata);
       gossip->next = mime_headers->autocrypt_gossip;
@@ -859,7 +859,7 @@ int mutt_autocrypt_generate_gossip_list(struct Email *e)
 
     if (keydata)
     {
-      struct AutocryptHeader *gossip = mutt_new_autocrypthdr();
+      struct AutocryptHeader *gossip = mutt_autocrypthdr_new();
       gossip->addr = mutt_str_strdup(addr);
       gossip->keydata = mutt_str_strdup(keydata);
       gossip->next = mime_headers->autocrypt_gossip;
index cab10091e50edd53325001a11e61850a891cd357..c239772c3ceadee4e03089fec3b0881cc258c5f8 100644 (file)
@@ -239,16 +239,18 @@ struct AutocryptAccount *mutt_autocrypt_db_account_new(void)
 
 /**
  * mutt_autocrypt_db_account_free - Free an AutocryptAccount
- * @param account Account to free
+ * @param ptr Account to free
  */
-void mutt_autocrypt_db_account_free(struct AutocryptAccount **account)
+void mutt_autocrypt_db_account_free(struct AutocryptAccount **ptr)
 {
-  if (!account || !*account)
+  if (!ptr || !*ptr)
     return;
-  FREE(&(*account)->email_addr);
-  FREE(&(*account)->keyid);
-  FREE(&(*account)->keydata);
-  FREE(account);
+
+  struct AutocryptAccount *ac = *ptr;
+  FREE(&ac->email_addr);
+  FREE(&ac->keyid);
+  FREE(&ac->keydata);
+  FREE(ptr);
 }
 
 /**
@@ -521,18 +523,20 @@ struct AutocryptPeer *mutt_autocrypt_db_peer_new(void)
 
 /**
  * mutt_autocrypt_db_peer_free - Free an AutocryptPeer
- * @param peer AutocryptPeer to free
+ * @param ptr AutocryptPeer to free
  */
-void mutt_autocrypt_db_peer_free(struct AutocryptPeer **peer)
+void mutt_autocrypt_db_peer_free(struct AutocryptPeer **ptr)
 {
-  if (!peer || !*peer)
+  if (!ptr || !*ptr)
     return;
-  FREE(&(*peer)->email_addr);
-  FREE(&(*peer)->keyid);
-  FREE(&(*peer)->keydata);
-  FREE(&(*peer)->gossip_keyid);
-  FREE(&(*peer)->gossip_keydata);
-  FREE(peer);
+
+  struct AutocryptPeer *peer = *ptr;
+  FREE(&peer->email_addr);
+  FREE(&peer->keyid);
+  FREE(&peer->keydata);
+  FREE(&peer->gossip_keyid);
+  FREE(&peer->gossip_keydata);
+  FREE(ptr);
 }
 
 /**
@@ -734,16 +738,18 @@ struct AutocryptPeerHistory *mutt_autocrypt_db_peer_history_new(void)
 
 /**
  * mutt_autocrypt_db_peer_history_free - Free an AutocryptPeerHistory
- * @param peerhist AutocryptPeerHistory to free
+ * @param ptr AutocryptPeerHistory to free
  */
-void mutt_autocrypt_db_peer_history_free(struct AutocryptPeerHistory **peerhist)
+void mutt_autocrypt_db_peer_history_free(struct AutocryptPeerHistory **ptr)
 {
-  if (!peerhist || !*peerhist)
+  if (!ptr || !*ptr)
     return;
-  FREE(&(*peerhist)->peer_email_addr);
-  FREE(&(*peerhist)->email_msgid);
-  FREE(&(*peerhist)->keydata);
-  FREE(peerhist);
+
+  struct AutocryptPeerHistory *ph = *ptr;
+  FREE(&ph->peer_email_addr);
+  FREE(&ph->email_msgid);
+  FREE(&ph->keydata);
+  FREE(ptr);
 }
 
 /**
@@ -808,17 +814,19 @@ struct AutocryptGossipHistory *mutt_autocrypt_db_gossip_history_new(void)
 
 /**
  * mutt_autocrypt_db_gossip_history_free - Free an AutocryptGossipHistory
- * @param gossip_hist AutocryptGossipHistory to free
+ * @param ptr AutocryptGossipHistory to free
  */
-void mutt_autocrypt_db_gossip_history_free(struct AutocryptGossipHistory **gossip_hist)
+void mutt_autocrypt_db_gossip_history_free(struct AutocryptGossipHistory **ptr)
 {
-  if (!gossip_hist || !*gossip_hist)
+  if (!ptr || !*ptr)
     return;
-  FREE(&(*gossip_hist)->peer_email_addr);
-  FREE(&(*gossip_hist)->sender_email_addr);
-  FREE(&(*gossip_hist)->email_msgid);
-  FREE(&(*gossip_hist)->gossip_keydata);
-  FREE(gossip_hist);
+
+  struct AutocryptGossipHistory *gh = *ptr;
+  FREE(&gh->peer_email_addr);
+  FREE(&gh->sender_email_addr);
+  FREE(&gh->email_msgid);
+  FREE(&gh->gossip_keydata);
+  FREE(ptr);
 }
 
 /**
index 7d6d12aa2f933a4a24a14866799cc5504200e307..3363e71974a7a768fc68e327f7672f9ac54b2c1f 100644 (file)
@@ -40,22 +40,22 @@ int                            mutt_autocrypt_account_init(bool prompt);
 void                           mutt_autocrypt_scan_mailboxes(void);
 
 int                            mutt_autocrypt_db_account_delete(struct AutocryptAccount *acct);
-void                           mutt_autocrypt_db_account_free(struct AutocryptAccount **account);
+void                           mutt_autocrypt_db_account_free(struct AutocryptAccount **ptr);
 int                            mutt_autocrypt_db_account_get(struct Address *addr, struct AutocryptAccount **account);
 int                            mutt_autocrypt_db_account_get_all(struct AutocryptAccount ***accounts, int *num_accounts);
 int                            mutt_autocrypt_db_account_insert(struct Address *addr, const char *keyid, const char *keydata, bool prefer_encrypt);
 struct AutocryptAccount *      mutt_autocrypt_db_account_new(void);
 int                            mutt_autocrypt_db_account_update(struct AutocryptAccount *acct);
 void                           mutt_autocrypt_db_close(void);
-void                           mutt_autocrypt_db_gossip_history_free(struct AutocryptGossipHistory **gossip_hist);
+void                           mutt_autocrypt_db_gossip_history_free(struct AutocryptGossipHistory **ptr);
 int                            mutt_autocrypt_db_gossip_history_insert(struct Address *addr, struct AutocryptGossipHistory *gossip_hist);
 struct AutocryptGossipHistory *mutt_autocrypt_db_gossip_history_new(void);
 int                            mutt_autocrypt_db_init(bool can_create);
 void                           mutt_autocrypt_db_normalize_addr(struct Address *a);
 void                           mutt_autocrypt_db_normalize_addrlist(struct AddressList *al);
-void                           mutt_autocrypt_db_peer_free(struct AutocryptPeer **peer);
+void                           mutt_autocrypt_db_peer_free(struct AutocryptPeer **ptr);
 int                            mutt_autocrypt_db_peer_get(struct Address *addr, struct AutocryptPeer **peer);
-void                           mutt_autocrypt_db_peer_history_free(struct AutocryptPeerHistory **peerhist);
+void                           mutt_autocrypt_db_peer_history_free(struct AutocryptPeerHistory **ptr);
 int                            mutt_autocrypt_db_peer_history_insert(struct Address *addr, struct AutocryptPeerHistory *peerhist);
 struct AutocryptPeerHistory *  mutt_autocrypt_db_peer_history_new(void);
 int                            mutt_autocrypt_db_peer_insert(struct Address *addr, struct AutocryptPeer *peer);
diff --git a/color.c b/color.c
index 574c8a8b50a5d92c09670a0be61d7be4503346fe..57d4d54d98661f6439a0210e083d6002036dbbbb 100644 (file)
--- a/color.c
+++ b/color.c
@@ -169,10 +169,10 @@ static const struct Mapping ComposeFields[] = {
 #define COLOR_QUOTE_INIT 8
 
 /**
- * new_color_line - Create a new ColorLine
+ * color_line_new - Create a new ColorLine
  * @retval ptr Newly allocated ColorLine
  */
-static struct ColorLine *new_color_line(void)
+static struct ColorLine *color_line_new(void)
 {
   struct ColorLine *p = mutt_mem_calloc(1, sizeof(struct ColorLine));
 
@@ -183,25 +183,26 @@ static struct ColorLine *new_color_line(void)
 }
 
 /**
- * free_color_line - Free a ColorLine
- * @param tmp         ColorLine to free
+ * color_line_free - Free a ColorLine
+ * @param ptr         ColorLine to free
  * @param free_colors If true, free its colours too
  */
-static void free_color_line(struct ColorLine *tmp, bool free_colors)
+static void color_line_free(struct ColorLine **ptr, bool free_colors)
 {
-  if (!tmp)
+  if (!ptr || !*ptr)
     return;
 
+  struct ColorLine *cl = *ptr;
+
 #ifdef HAVE_COLOR
-  if (free_colors && (tmp->fg != COLOR_UNSET) && (tmp->bg != COLOR_UNSET))
-    mutt_free_color(tmp->fg, tmp->bg);
+  if (free_colors && (cl->fg != COLOR_UNSET) && (cl->bg != COLOR_UNSET))
+    mutt_free_color(cl->fg, cl->bg);
 #endif
 
-  /* we should really introduce a container type for regular expressions.  */
-  regfree(&tmp->regex);
-  mutt_pattern_free(&tmp->color_pattern);
-  FREE(&tmp->pattern);
-  FREE(&tmp);
+  regfree(&cl->regex);
+  mutt_pattern_free(&cl->color_pattern);
+  FREE(&cl->pattern);
+  FREE(ptr);
 }
 
 /**
@@ -588,7 +589,7 @@ static void do_uncolor(struct Buffer *buf, struct Buffer *s,
         {
           *do_cache = true;
         }
-        free_color_line(np, parse_uncolor);
+        color_line_free(&np, parse_uncolor);
         np = tmp;
       }
       STAILQ_INIT(cl);
@@ -610,7 +611,7 @@ static void do_uncolor(struct Buffer *buf, struct Buffer *s,
             STAILQ_REMOVE_AFTER(cl, tmp, entries);
           else
             STAILQ_REMOVE_HEAD(cl, entries);
-          free_color_line(np, parse_uncolor);
+          color_line_free(&np, parse_uncolor);
           break;
         }
         tmp = np;
@@ -800,7 +801,7 @@ static enum CommandResult add_pattern(struct ColorLineList *top, const char *s,
   }
   else
   {
-    tmp = new_color_line();
+    tmp = color_line_new();
     if (is_index)
     {
       struct Buffer *buf = mutt_buffer_pool_get();
@@ -810,7 +811,7 @@ static enum CommandResult add_pattern(struct ColorLineList *top, const char *s,
       mutt_buffer_pool_release(&buf);
       if (!tmp->color_pattern)
       {
-        free_color_line(tmp, true);
+        color_line_free(&tmp, true);
         return MUTT_CMD_ERROR;
       }
     }
@@ -826,7 +827,7 @@ static enum CommandResult add_pattern(struct ColorLineList *top, const char *s,
       if (r != 0)
       {
         regerror(r, &tmp->regex, err->data, err->dsize);
-        free_color_line(tmp, true);
+        color_line_free(&tmp, true);
         return MUTT_CMD_ERROR;
       }
     }
@@ -1252,7 +1253,7 @@ static void mutt_free_color_list(struct ColorLineList *list)
   STAILQ_FOREACH_SAFE(np, list, entries, tmp)
   {
     STAILQ_REMOVE(list, np, ColorLine, entries);
-    free_color_line(np, true);
+    color_line_free(&np, true);
   }
 }
 
index 34b8d926f3fb47266fe5ef43d2af6a65447594a7..c8b15dcdebc62ac8da1ae20d904d89129af7cabe 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -1080,7 +1080,7 @@ int mutt_compose_menu(struct Email *e, char *fcc, size_t fcclen, struct Email *e
   menu->redraw_data = rd;
   mutt_menu_push_current(menu);
 
-  struct AttachCtx *actx = mutt_mem_calloc(sizeof(struct AttachCtx), 1);
+  struct AttachCtx *actx = mutt_actx_new();
   actx->email = e;
   mutt_update_compose_menu(actx, menu, true);
 
index caa279a0b69f4a6caf75c7529abaff052cdce609..4c4c8df9f31870969f6a7be6d89425409d531b5a 100644 (file)
@@ -124,21 +124,30 @@ void mutt_actx_free_entries(struct AttachCtx *actx)
   actx->body_len = 0;
 }
 
+/**
+ * mutt_actx_new - Create a new Attachment Context
+ * @retval ptr New Attachment Context
+ */
+struct AttachCtx *mutt_actx_new(void)
+{
+  return mutt_mem_calloc(1, sizeof(struct AttachCtx));
+}
+
 /**
  * mutt_actx_free - Free an Attachment Context
- * @param[out] pactx Attachment context
+ * @param[out] ptr Attachment context
  */
-void mutt_actx_free(struct AttachCtx **pactx)
+void mutt_actx_free(struct AttachCtx **ptr)
 {
-  if (!pactx || !*pactx)
+  if (!ptr || !*ptr)
     return;
 
-  struct AttachCtx *actx = *pactx;
+  struct AttachCtx *actx = *ptr;
 
   mutt_actx_free_entries(actx);
   FREE(&actx->idx);
   FREE(&actx->v2r);
   FREE(&actx->fp_idx);
   FREE(&actx->body_idx);
-  FREE(pactx);
+  FREE(ptr);
 }
index dd407dab519c69ae7be39cc2e77f1e8d6906006f..0c38c37db79232ff2c3dba7f186e489b61f43aa5 100644 (file)
@@ -67,10 +67,11 @@ struct AttachCtx
   short body_max;         ///< Size of Body array
 };
 
-void mutt_actx_add_attach  (struct AttachCtx *actx, struct AttachPtr *attach);
-void mutt_actx_add_body    (struct AttachCtx *actx, struct Body *new_body);
-void mutt_actx_add_fp      (struct AttachCtx *actx, FILE *fp_new);
-void mutt_actx_free        (struct AttachCtx **pactx);
-void mutt_actx_free_entries(struct AttachCtx *actx);
+void              mutt_actx_add_attach  (struct AttachCtx *actx, struct AttachPtr *attach);
+void              mutt_actx_add_body    (struct AttachCtx *actx, struct Body *new_body);
+void              mutt_actx_add_fp      (struct AttachCtx *actx, FILE *fp_new);
+void              mutt_actx_free        (struct AttachCtx **ptr);
+void              mutt_actx_free_entries(struct AttachCtx *actx);
+struct AttachCtx *mutt_actx_new         (void);
 
 #endif /* MUTT_EMAIL_ATTACH_H */
index b286e428f663721220e3bdd1dc7e34eec22b9fcf..2d4a091fbd6ac8c2207ed7a25b375f9831b1ade2 100644 (file)
@@ -59,10 +59,19 @@ struct Envelope *mutt_env_new(void)
 
 #ifdef USE_AUTOCRYPT
 /**
- * mutt_free_autocrypthdr - Free an AutocryptHeader
+ * mutt_autocrypthdr_new - Create a new AutocryptHeader
+ * @retval ptr New AutocryptHeader
+ */
+void mutt_autocrypthdr_new(void)
+{
+  return mutt_mem_calloc(1, sizeof(struct AutocryptHeader));
+}
+
+/**
+ * mutt_autocrypthdr_free - Free an AutocryptHeader
  * @param p AutocryptHeader to free
  */
-void mutt_free_autocrypthdr(struct AutocryptHeader **p)
+void mutt_autocrypthdr_free(struct AutocryptHeader **p)
 {
   if (!p)
     return;
@@ -124,8 +133,8 @@ void mutt_env_free(struct Envelope **ptr)
   mutt_list_free(&env->userhdrs);
 
 #ifdef USE_AUTOCRYPT
-  mutt_free_autocrypthdr(&env->autocrypt);
-  mutt_free_autocrypthdr(&env->autocrypt_gossip);
+  mutt_autocrypthdr_free(&env->autocrypt);
+  mutt_autocrypthdr_free(&env->autocrypt_gossip);
 #endif
 
   FREE(ptr);
index 7b3adac1ed23809baa3842c16ac09d62e570ed23..0d5b22d78cc9f15ededa9dcb7cf86f867bdbd452 100644 (file)
@@ -96,8 +96,8 @@ int              mutt_env_to_intl   (struct Envelope *env, const char **tag, cha
 void             mutt_env_to_local  (struct Envelope *e);
 
 #ifdef USE_AUTOCRYPT
-#define mutt_new_autocrypthdr() mutt_mem_calloc(1, sizeof(struct AutocryptHeader))
-void mutt_free_autocrypthdr(struct AutocryptHeader **p);
+struct AutocryptHeader *mutt_autocrypthdr_new(void);
+void                    mutt_autocrypthdr_free(struct AutocryptHeader **p);
 #endif
 
 #endif /* MUTT_EMAIL_ENVELOPE_H */
index 082ec529ad83a15e495363e2363613eb5a032593..b12d4db89e075b2e996b5dadb6bd042630aa8f29 100644 (file)
@@ -552,7 +552,7 @@ void mutt_parse_content_type(const char *s, struct Body *ct)
  */
 static struct AutocryptHeader *parse_autocrypt(struct AutocryptHeader *head, const char *s)
 {
-  struct AutocryptHeader *autocrypt = mutt_new_autocrypthdr();
+  struct AutocryptHeader *autocrypt = mutt_autocrypthdr_new();
   autocrypt->next = head;
 
   struct ParameterList pl = TAILQ_HEAD_INITIALIZER(pl);
@@ -1267,7 +1267,7 @@ struct Envelope *mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hd
     {
       mutt_autocrypt_process_autocrypt_header(e, env);
       /* No sense in taking up memory after the header is processed */
-      mutt_free_autocrypthdr(&env->autocrypt);
+      mutt_autocrypthdr_free(&env->autocrypt);
     }
 #endif
   }
index b6aad2af068277cb68ad4aa1c4df22f7f4049d48..b571f9b62e9c67661b7f3170e4460affd0033e23 100644 (file)
@@ -128,10 +128,10 @@ static void decode_one(char *dest, char *src)
 }
 
 /**
- * new_parameter - Create a new Rfc2231Parameter
+ * parameter_new - Create a new Rfc2231Parameter
  * @retval ptr Newly allocated Rfc2231Parameter
  */
-static struct Rfc2231Parameter *new_parameter(void)
+static struct Rfc2231Parameter *parameter_new(void)
 {
   return mutt_mem_calloc(1, sizeof(struct Rfc2231Parameter));
 }
@@ -292,7 +292,7 @@ void rfc2231_decode_parameters(struct ParameterList *pl)
       if (mutt_str_atoi(s, &index) != 0)
         index = INT_MAX;
 
-      conttmp = new_parameter();
+      conttmp = parameter_new();
       conttmp->attribute = np->attribute;
       conttmp->value = np->value;
       conttmp->encoded = encoded;
diff --git a/init.c b/init.c
index e32d1fda07c9f6f48a98fb5e6ed1ed4ef1834165..6e15fa76c208d8778f194072cd96212d7e09a2c2 100644 (file)
--- a/init.c
+++ b/init.c
@@ -454,6 +454,15 @@ static bool get_hostname(void)
   return true;
 }
 
+/**
+ * mutt_attachmatch_new - Create a new AttachMatch
+ * @retval ptr New AttachMatch
+ */
+static struct AttachMatch *mutt_attachmatch_new(void)
+{
+  return mutt_mem_calloc(1, sizeof(struct AttachMatch));
+}
+
 /**
  * parse_attach_list - Parse the "attachments" command
  * @param buf  Buffer for temporary storage
@@ -478,7 +487,7 @@ static enum CommandResult parse_attach_list(struct Buffer *buf, struct Buffer *s
     if (!buf->data || (*buf->data == '\0'))
       continue;
 
-    a = mutt_mem_malloc(sizeof(struct AttachMatch));
+    a = mutt_attachmatch_new();
 
     /* some cheap hacks that I expect to remove */
     if (mutt_str_strcasecmp(buf->data, "any") == 0)
@@ -2271,12 +2280,12 @@ static enum CommandResult parse_unalternates(struct Buffer *buf, struct Buffer *
 }
 
 /**
- * mutt_free_attachmatch - Free an AttachMatch - Implements ::list_free_t
+ * mutt_attachmatch_free - Free an AttachMatch - Implements ::list_free_t
  *
  * @note We don't free minor because it is either a pointer into major,
  *       or a static string.
  */
-void mutt_free_attachmatch(struct AttachMatch **am)
+void mutt_attachmatch_free(struct AttachMatch **am)
 {
   if (!am || !*am)
     return;
@@ -2308,10 +2317,10 @@ static enum CommandResult parse_unattachments(struct Buffer *buf, struct Buffer
 
   if (op == '*')
   {
-    mutt_list_free_type(&AttachAllow, (list_free_t) mutt_free_attachmatch);
-    mutt_list_free_type(&AttachExclude, (list_free_t) mutt_free_attachmatch);
-    mutt_list_free_type(&InlineAllow, (list_free_t) mutt_free_attachmatch);
-    mutt_list_free_type(&InlineExclude, (list_free_t) mutt_free_attachmatch);
+    mutt_list_free_type(&AttachAllow, (list_free_t) mutt_attachmatch_free);
+    mutt_list_free_type(&AttachExclude, (list_free_t) mutt_attachmatch_free);
+    mutt_list_free_type(&InlineAllow, (list_free_t) mutt_attachmatch_free);
+    mutt_list_free_type(&InlineExclude, (list_free_t) mutt_attachmatch_free);
     attachments_clean();
     return 0;
   }
@@ -2909,10 +2918,10 @@ void mutt_free_opts(void)
   mutt_list_free(&UserHeader);
 
   /* Lists of AttachMatch */
-  mutt_list_free_type(&AttachAllow, (list_free_t) mutt_free_attachmatch);
-  mutt_list_free_type(&AttachExclude, (list_free_t) mutt_free_attachmatch);
-  mutt_list_free_type(&InlineAllow, (list_free_t) mutt_free_attachmatch);
-  mutt_list_free_type(&InlineExclude, (list_free_t) mutt_free_attachmatch);
+  mutt_list_free_type(&AttachAllow, (list_free_t) mutt_attachmatch_free);
+  mutt_list_free_type(&AttachExclude, (list_free_t) mutt_attachmatch_free);
+  mutt_list_free_type(&InlineAllow, (list_free_t) mutt_attachmatch_free);
+  mutt_list_free_type(&InlineExclude, (list_free_t) mutt_attachmatch_free);
 
   mutt_free_colors();
 
index 3ef9bfc6932038e75e1ae6bcf9418c1726f4c0d0..6e521be02ac4d4abe77732a66f50448a2ce6949c 100644 (file)
@@ -127,14 +127,14 @@ static int cmp_int_key(union HashKey a, union HashKey b)
 }
 
 /**
- * new_hash - Create a new Hash table
+ * hash_new - Create a new Hash table
  * @param nelem Number of elements it should contain
  * @retval ptr New Hash table
  *
  * The Hash table can contain more elements than nelem, but they will be
  * chained together.
  */
-static struct Hash *new_hash(size_t nelem)
+static struct Hash *hash_new(size_t nelem)
 {
   struct Hash *table = mutt_mem_calloc(1, sizeof(struct Hash));
   if (nelem == 0)
@@ -275,7 +275,7 @@ static void union_hash_delete(struct Hash *table, union HashKey key, const void
  */
 struct Hash *mutt_hash_new(size_t nelem, HashFlags flags)
 {
-  struct Hash *table = new_hash(nelem);
+  struct Hash *table = hash_new(nelem);
   if (flags & MUTT_HASH_STRCASECMP)
   {
     table->gen_hash = gen_case_string_hash;
@@ -301,7 +301,7 @@ struct Hash *mutt_hash_new(size_t nelem, HashFlags flags)
  */
 struct Hash *mutt_hash_int_new(size_t nelem, HashFlags flags)
 {
-  struct Hash *table = new_hash(nelem);
+  struct Hash *table = hash_new(nelem);
   table->gen_hash = gen_int_hash;
   table->cmp_key = cmp_int_key;
   if (flags & MUTT_HASH_ALLOW_DUPS)
index a90c67bf278dcb6e446594bbf77cb1697c3b0e7b..1049d5654e4b27b487060bb9718ec9fac929ca92 100644 (file)
@@ -243,10 +243,10 @@ void pgp_free_key(struct PgpKeyInfo **kpp)
 }
 
 /**
- * pgp_new_keyinfo - Create a new PgpKeyInfo
+ * pgp_keyinfo_new - Create a new PgpKeyInfo
  * @retval ptr New PgpKeyInfo
  */
-struct PgpKeyInfo *pgp_new_keyinfo(void)
+struct PgpKeyInfo *pgp_keyinfo_new(void)
 {
   return mutt_mem_calloc(1, sizeof(struct PgpKeyInfo));
 }
index 1aeda8925e838204a14a492ce5903b40ef648dad..b55d7108f582116d853c8162e4c3525314150b68 100644 (file)
@@ -69,6 +69,6 @@ void pgp_free_key(struct PgpKeyInfo **kpp);
 
 struct PgpKeyInfo *pgp_remove_key(struct PgpKeyInfo **klist, struct PgpKeyInfo *key);
 
-struct PgpKeyInfo *pgp_new_keyinfo(void);
+struct PgpKeyInfo *pgp_keyinfo_new(void);
 
 #endif /* MUTT_NCRYPT_PGPLIB_H */
diff --git a/pager.c b/pager.c
index 29d09524ed81a0a44500623fee40bb959b785f86..53bf717c4215e1c4b2a83174d27944d25a485025 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -510,11 +510,11 @@ static void append_line(struct Line *line_info, int n, int cnt)
 }
 
 /**
- * new_class_color - Create a new quoting colour
+ * class_color_new - Create a new quoting colour
  * @param[in]     qc      Class of quoted text
  * @param[in,out] q_level Quote level
  */
-static void new_class_color(struct QClass *qc, int *q_level)
+static void class_color_new(struct QClass *qc, int *q_level)
 {
   qc->index = (*q_level)++;
   qc->color = ColorQuote[qc->index % ColorQuoteUsed];
@@ -852,7 +852,7 @@ static struct QClass *classify_quote(struct QClass **quote_list, const char *qpt
           ptr->down = tmp;
           tmp->up = ptr;
 
-          new_class_color(tmp, q_level);
+          class_color_new(tmp, q_level);
 
           return tmp;
         }
@@ -880,7 +880,7 @@ static struct QClass *classify_quote(struct QClass **quote_list, const char *qpt
     qc->prefix = mutt_mem_calloc(1, length + 1);
     strncpy(qc->prefix, qptr, length);
     qc->length = length;
-    new_class_color(qc, q_level);
+    class_color_new(qc, q_level);
 
     if (*quote_list)
     {
index 46b54650b419d44ef9326dd71ab8f30b69cce7a6..1c4924e9c45cbf1838b23348f936617022d260cc 100644 (file)
@@ -1422,7 +1422,7 @@ void mutt_view_attachments(struct Email *e)
   menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_ATTACH, AttachHelp);
   mutt_menu_push_current(menu);
 
-  struct AttachCtx *actx = mutt_mem_calloc(1, sizeof(struct AttachCtx));
+  struct AttachCtx *actx = mutt_actx_new();
   actx->email = e;
   actx->fp_root = msg->fp;
   mutt_update_recvattach_menu(actx, menu, true);