From: Richard Russon Date: Sat, 31 Aug 2019 13:45:55 +0000 (+0100) Subject: unify new/free() functions 2 X-Git-Tag: 2019-10-25~63^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=396c9ab47d61d7642a7d62e60130b37575076981;p=neomutt unify new/free() functions 2 '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() --- diff --git a/autocrypt/autocrypt.c b/autocrypt/autocrypt.c index ede2a8fd4..cc5e1b94e 100644 --- a/autocrypt/autocrypt.c +++ b/autocrypt/autocrypt.c @@ -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; diff --git a/autocrypt/autocrypt_db.c b/autocrypt/autocrypt_db.c index cab10091e..c239772c3 100644 --- a/autocrypt/autocrypt_db.c +++ b/autocrypt/autocrypt_db.c @@ -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); } /** diff --git a/autocrypt/autocrypt_private.h b/autocrypt/autocrypt_private.h index 7d6d12aa2..3363e7197 100644 --- a/autocrypt/autocrypt_private.h +++ b/autocrypt/autocrypt_private.h @@ -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 574c8a8b5..57d4d54d9 100644 --- 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); } } diff --git a/compose.c b/compose.c index 34b8d926f..c8b15dcde 100644 --- 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); diff --git a/email/attach.c b/email/attach.c index caa279a0b..4c4c8df9f 100644 --- a/email/attach.c +++ b/email/attach.c @@ -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); } diff --git a/email/attach.h b/email/attach.h index dd407dab5..0c38c37db 100644 --- a/email/attach.h +++ b/email/attach.h @@ -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 */ diff --git a/email/envelope.c b/email/envelope.c index b286e428f..2d4a091fb 100644 --- a/email/envelope.c +++ b/email/envelope.c @@ -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); diff --git a/email/envelope.h b/email/envelope.h index 7b3adac1e..0d5b22d78 100644 --- a/email/envelope.h +++ b/email/envelope.h @@ -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 */ diff --git a/email/parse.c b/email/parse.c index 082ec529a..b12d4db89 100644 --- a/email/parse.c +++ b/email/parse.c @@ -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 } diff --git a/email/rfc2231.c b/email/rfc2231.c index b6aad2af0..b571f9b62 100644 --- a/email/rfc2231.c +++ b/email/rfc2231.c @@ -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 e32d1fda0..6e15fa76c 100644 --- 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(); diff --git a/mutt/hash.c b/mutt/hash.c index 3ef9bfc69..6e521be02 100644 --- a/mutt/hash.c +++ b/mutt/hash.c @@ -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) diff --git a/ncrypt/pgplib.c b/ncrypt/pgplib.c index a90c67bf2..1049d5654 100644 --- a/ncrypt/pgplib.c +++ b/ncrypt/pgplib.c @@ -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)); } diff --git a/ncrypt/pgplib.h b/ncrypt/pgplib.h index 1aeda8925..b55d7108f 100644 --- a/ncrypt/pgplib.h +++ b/ncrypt/pgplib.h @@ -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 29d09524e..53bf717c4 100644 --- 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) { diff --git a/recvattach.c b/recvattach.c index 46b54650b..1c4924e9c 100644 --- a/recvattach.c +++ b/recvattach.c @@ -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);