From: Richard Russon Date: Tue, 16 Jul 2019 18:25:21 +0000 (+0100) Subject: email: shorten function names X-Git-Tag: 2019-10-25~131^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=237762091ec862d1c0a3badadb27d48142960467;p=neomutt email: shorten function names --- diff --git a/commands.c b/commands.c index ab2072df0..a0b28fd6f 100644 --- a/commands.c +++ b/commands.c @@ -1266,7 +1266,7 @@ bool mutt_edit_content_type(struct Email *e, struct Body *b, FILE *fp) { structure_changed = true; b->email->content = NULL; - mutt_email_free(&b->email); + email_free(&b->email); } if (fp && !b->parts && (is_multipart(b) || mutt_is_message_type(b->type, b->subtype))) diff --git a/context.c b/context.c index ccb4d2611..c24897377 100644 --- a/context.c +++ b/context.c @@ -249,7 +249,7 @@ void ctx_update_tables(struct Context *ctx, bool committing) * last_tag being stale if it's not reset here. */ if (ctx->last_tag == m->emails[i]) ctx->last_tag = NULL; - mutt_email_free(&m->emails[i]); + email_free(&m->emails[i]); } } m->msg_count = j; diff --git a/context.h b/context.h index eb903b132..cd0f67f38 100644 --- a/context.h +++ b/context.h @@ -63,6 +63,6 @@ bool message_is_visible(struct Context *ctx, int index); int el_add_email(struct EmailList *el, struct Email *e); int el_add_tagged(struct EmailList *el, struct Context *ctx, struct Email *e, bool use_tagged); -void mutt_emaillist_clear(struct EmailList *el); +void emaillist_clear(struct EmailList *el); #endif /* MUTT_CONTEXT_H */ diff --git a/core/mailbox.c b/core/mailbox.c index 5df958821..6e427c864 100644 --- a/core/mailbox.c +++ b/core/mailbox.c @@ -171,7 +171,7 @@ void mailbox_changed(struct Mailbox *m, enum MailboxNotification action) */ void mailbox_size_add(struct Mailbox *m, const struct Email *e) { - m->size += mutt_email_size(e); + m->size += email_size(e); } /** @@ -181,5 +181,5 @@ void mailbox_size_add(struct Mailbox *m, const struct Email *e) */ void mailbox_size_sub(struct Mailbox *m, const struct Email *e) { - m->size -= mutt_email_size(e); + m->size -= email_size(e); } diff --git a/email/body.c b/email/body.c index cb0f821c9..846f54131 100644 --- a/email/body.c +++ b/email/body.c @@ -88,7 +88,7 @@ void mutt_body_free(struct Body **p) { /* Don't free twice (b->email->content = b->parts) */ b->email->content = NULL; - mutt_email_free(&b->email); + email_free(&b->email); } mutt_env_free(&b->mime_headers); diff --git a/email/email.c b/email/email.c index a9c295b48..4e83d97da 100644 --- a/email/email.c +++ b/email/email.c @@ -35,10 +35,10 @@ #include "tags.h" /** - * mutt_email_free - Free an Email + * email_free - Free an Email * @param[out] e Email to free */ -void mutt_email_free(struct Email **e) +void email_free(struct Email **e) { if (!e || !*e) return; @@ -57,10 +57,10 @@ void mutt_email_free(struct Email **e) } /** - * mutt_email_new - Create a new Email + * email_new - Create a new Email * @retval ptr Newly created Email */ -struct Email *mutt_email_new(void) +struct Email *email_new(void) { struct Email *e = mutt_mem_calloc(1, sizeof(struct Email)); #ifdef MIXMASTER @@ -71,12 +71,12 @@ struct Email *mutt_email_new(void) } /** - * mutt_email_cmp_strict - Strictly compare message emails + * email_cmp_strict - Strictly compare message emails * @param e1 First Email * @param e2 Second Email * @retval true Emails are strictly identical */ -bool mutt_email_cmp_strict(const struct Email *e1, const struct Email *e2) +bool email_cmp_strict(const struct Email *e1, const struct Email *e2) { if (e1 && e2) { @@ -102,11 +102,11 @@ bool mutt_email_cmp_strict(const struct Email *e1, const struct Email *e2) } /** - * mutt_email_size - compute the size of an email + * email_size - compute the size of an email * @param e Email * @retval num Size of the email, in bytes */ -size_t mutt_email_size(const struct Email *e) +size_t email_size(const struct Email *e) { if (!e || !e->content) return 0; @@ -114,12 +114,12 @@ size_t mutt_email_size(const struct Email *e) } /** - * mutt_emaillist_clear - Drop a private list of Emails + * emaillist_clear - Drop a private list of Emails * @param el EmailList to empty * * The Emails are not freed. */ -void mutt_emaillist_clear(struct EmailList *el) +void emaillist_clear(struct EmailList *el) { if (!el) return; diff --git a/email/email.h b/email/email.h index a840f1718..0feaa6d6f 100644 --- a/email/email.h +++ b/email/email.h @@ -121,11 +121,11 @@ struct EmailNode }; STAILQ_HEAD(EmailList, EmailNode); -bool mutt_email_cmp_strict(const struct Email *e1, const struct Email *e2); -void mutt_email_free (struct Email **e); -struct Email *mutt_email_new (void); -size_t mutt_email_size (const struct Email *e); +bool email_cmp_strict(const struct Email *e1, const struct Email *e2); +void email_free (struct Email **e); +struct Email *email_new (void); +size_t email_size (const struct Email *e); -void mutt_emaillist_clear(struct EmailList *el); +void emaillist_clear(struct EmailList *el); #endif /* MUTT_EMAIL_EMAIL_H */ diff --git a/email/parse.c b/email/parse.c index 0214e2b73..ccb88ec4d 100644 --- a/email/parse.c +++ b/email/parse.c @@ -1445,7 +1445,7 @@ struct Body *mutt_rfc822_parse_message(FILE *fp, struct Body *parent) if (!fp || !parent) return NULL; - parent->email = mutt_email_new(); + parent->email = email_new(); parent->email->offset = ftello(fp); parent->email->env = mutt_rfc822_read_header(fp, parent->email, false, false); struct Body *msg = parent->email->content; diff --git a/hcache/serialize.c b/hcache/serialize.c index 61dc57b4e..78ff8faa3 100644 --- a/hcache/serialize.c +++ b/hcache/serialize.c @@ -642,12 +642,12 @@ void *mutt_hcache_dump(header_cache_t *hc, const struct Email *e, int *off, unsi * @retval ptr Success, the restored header (can't be NULL) * * @note The returned Email must be free'd by caller code with - * mutt_email_free(). + * email_free(). */ struct Email *mutt_hcache_restore(const unsigned char *d) { int off = 0; - struct Email *e = mutt_email_new(); + struct Email *e = email_new(); bool convert = !CharsetIsUtf8; /* skip validate */ diff --git a/hdrline.c b/hdrline.c index 48914f575..b4a76f6d0 100644 --- a/hdrline.c +++ b/hdrline.c @@ -657,7 +657,7 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co case 'c': colorlen = add_index_color(buf, buflen, flags, MT_COLOR_INDEX_SIZE); - mutt_str_pretty_size(tmp, sizeof(tmp), mutt_email_size(e)); + mutt_str_pretty_size(tmp, sizeof(tmp), email_size(e)); mutt_format_s(buf + colorlen, buflen - colorlen, prec, tmp); add_index_color(buf + colorlen, buflen - colorlen, flags, MT_COLOR_INDEX); break; diff --git a/imap/message.c b/imap/message.c index d411aa888..d766fd9dc 100644 --- a/imap/message.c +++ b/imap/message.c @@ -1149,7 +1149,7 @@ static int read_headers_fetch_new(struct Mailbox *m, unsigned int msn_begin, continue; } - m->emails[idx] = mutt_email_new(); + m->emails[idx] = email_new(); mdata->max_msn = MAX(mdata->max_msn, h.edata->msn); mdata->msn_index[h.edata->msn - 1] = m->emails[idx]; diff --git a/index.c b/index.c index 31fd1e490..e0b853def 100644 --- a/index.c +++ b/index.c @@ -1833,7 +1833,7 @@ int mutt_index_menu(void) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); ci_send_message(SEND_TO_SENDER, NULL, NULL, Context, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); menu->redraw = REDRAW_FULL; break; } @@ -2343,7 +2343,7 @@ int mutt_index_menu(void) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); mutt_check_traditional_pgp(&el, &menu->redraw); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } int hint = Context->mailbox->emails[Context->mailbox->v2r[menu->current]]->index; @@ -2457,7 +2457,7 @@ int mutt_index_menu(void) else mutt_error(_("No thread linked")); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } if (menu->menu == MENU_PAGER) @@ -2608,7 +2608,7 @@ int mutt_index_menu(void) else menu->redraw |= REDRAW_CURRENT; } - mutt_emaillist_clear(&el); + emaillist_clear(&el); break; } @@ -2920,7 +2920,7 @@ int mutt_index_menu(void) else menu->redraw |= REDRAW_CURRENT; } - mutt_emaillist_clear(&el); + emaillist_clear(&el); break; } @@ -2980,7 +2980,7 @@ int mutt_index_menu(void) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); ci_bounce_message(Context->mailbox, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); break; } @@ -3011,7 +3011,7 @@ int mutt_index_menu(void) mutt_emails_set_flag(Context->mailbox, &el, MUTT_PURGE, (op == OP_PURGE_MESSAGE)); if (C_DeleteUntag) mutt_emails_set_flag(Context->mailbox, &el, MUTT_TAG, 0); - mutt_emaillist_clear(&el); + emaillist_clear(&el); if (tag) { @@ -3130,12 +3130,12 @@ int mutt_index_menu(void) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); mutt_check_traditional_pgp(&el, &menu->redraw); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); mutt_ev_message(Context->mailbox, &el, edit ? EVM_EDIT : EVM_VIEW); - mutt_emaillist_clear(&el); + emaillist_clear(&el); menu->redraw = REDRAW_FULL; break; @@ -3152,7 +3152,7 @@ int mutt_index_menu(void) mutt_check_traditional_pgp(&el, &menu->redraw); } ci_send_message(SEND_FORWARD, NULL, NULL, Context, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); menu->redraw = REDRAW_FULL; break; } @@ -3178,7 +3178,7 @@ int mutt_index_menu(void) mutt_check_traditional_pgp(&el, &menu->redraw); } ci_send_message(replyflags, NULL, NULL, Context, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); menu->redraw = REDRAW_FULL; break; } @@ -3191,7 +3191,7 @@ int mutt_index_menu(void) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); int num_changed = mutt_label_message(Context->mailbox, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); if (num_changed > 0) { @@ -3223,7 +3223,7 @@ int mutt_index_menu(void) mutt_check_traditional_pgp(&el, &menu->redraw); } ci_send_message(SEND_REPLY | SEND_LIST_REPLY, NULL, NULL, Context, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); menu->redraw = REDRAW_FULL; break; } @@ -3253,7 +3253,7 @@ int mutt_index_menu(void) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); crypt_extract_keys_from_messages(&el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); menu->redraw = REDRAW_FULL; break; } @@ -3269,7 +3269,7 @@ int mutt_index_menu(void) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); mutt_check_traditional_pgp(&el, &menu->redraw); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } if (menu->menu == MENU_PAGER) @@ -3287,7 +3287,7 @@ int mutt_index_menu(void) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); mutt_pipe_message(Context->mailbox, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); #ifdef USE_IMAP /* in an IMAP folder index with imap_peek=no, piping could change @@ -3307,7 +3307,7 @@ int mutt_index_menu(void) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, Context, CUR_EMAIL, tag); mutt_print_message(Context->mailbox, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); #ifdef USE_IMAP /* in an IMAP folder index with imap_peek=no, printing could change @@ -3447,7 +3447,7 @@ int mutt_index_menu(void) el_add_tagged(&el, Context, CUR_EMAIL, tag); ci_send_message(((op == OP_FOLLOWUP) ? SEND_REPLY : SEND_FORWARD) | SEND_NEWS, NULL, NULL, Context, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } menu->redraw = REDRAW_FULL; break; @@ -3465,7 +3465,7 @@ int mutt_index_menu(void) mutt_check_traditional_pgp(&el, &menu->redraw); } ci_send_message(SEND_REPLY, NULL, NULL, Context, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); menu->redraw = REDRAW_FULL; break; } @@ -3512,7 +3512,7 @@ int mutt_index_menu(void) mutt_emails_set_flag(Context->mailbox, &el, MUTT_DELETE, 0); mutt_emails_set_flag(Context->mailbox, &el, MUTT_PURGE, 0); - mutt_emaillist_clear(&el); + emaillist_clear(&el); if (tag) { diff --git a/maildir/maildir.c b/maildir/maildir.c index e27f8681b..b36a30ddc 100644 --- a/maildir/maildir.c +++ b/maildir/maildir.c @@ -478,7 +478,7 @@ int maildir_mbox_check(struct Mailbox *m, int *index_hint) e->trash = p->email->trash; /* this is a duplicate of an existing header, so remove it */ - mutt_email_free(&p->email); + email_free(&p->email); } /* This message was not in the list of messages we just scanned. * Check to see if we have enough information to know if the diff --git a/maildir/mh.c b/maildir/mh.c index 5cb8702bd..7153cabd9 100644 --- a/maildir/mh.c +++ b/maildir/mh.c @@ -683,7 +683,7 @@ int mh_mbox_check(struct Mailbox *m, int *index_hint) m->emails[i]->active = false; p = mutt_hash_find(fnames, m->emails[i]->path); - if (p && p->email && mutt_email_cmp_strict(m->emails[i], p->email)) + if (p && p->email && email_cmp_strict(m->emails[i], p->email)) { m->emails[i]->active = true; /* found the right message */ @@ -691,7 +691,7 @@ int mh_mbox_check(struct Mailbox *m, int *index_hint) if (maildir_update_flags(m, m->emails[i], p->email)) flags_changed = true; - mutt_email_free(&p->email); + email_free(&p->email); } else /* message has disappeared */ occult = true; diff --git a/maildir/shared.c b/maildir/shared.c index 5a58f6478..c6bf3b80c 100644 --- a/maildir/shared.c +++ b/maildir/shared.c @@ -269,7 +269,7 @@ static void maildir_free_entry(struct Maildir **md) FREE(&(*md)->canon_fname); if ((*md)->email) - mutt_email_free(&(*md)->email); + email_free(&(*md)->email); FREE(md); } @@ -370,7 +370,7 @@ int maildir_parse_dir(struct Mailbox *m, struct Maildir ***last, /* FOO - really ignore the return value? */ mutt_debug(LL_DEBUG2, "queueing %s\n", de->d_name); - e = mutt_email_new(); + e = email_new(); e->old = is_old; if (m->magic == MUTT_MAILDIR) maildir_parse_flags(e, de->d_name); @@ -750,7 +750,7 @@ void maildir_delayed_parsing(struct Mailbox *m, struct Maildir **md, struct Prog struct Email *e = mutt_hcache_restore((unsigned char *) data); e->old = p->email->old; e->path = mutt_str_strdup(p->email->path); - mutt_email_free(&p->email); + email_free(&p->email); p->email = e; if (m->magic == MUTT_MAILDIR) maildir_parse_flags(p->email, fn); @@ -777,7 +777,7 @@ void maildir_delayed_parsing(struct Mailbox *m, struct Maildir **md, struct Prog #endif } else - mutt_email_free(&p->email); + email_free(&p->email); #ifdef USE_HCACHE } mutt_hcache_free(hc, &data); @@ -1315,7 +1315,7 @@ struct Email *maildir_parse_stream(enum MailboxType magic, FILE *fp, const char *fname, bool is_old, struct Email *e) { if (!e) - e = mutt_email_new(); + e = email_new(); e->env = mutt_rfc822_read_header(fp, e, false, false); struct stat st; diff --git a/main.c b/main.c index 8558deec3..a77883fee 100644 --- a/main.c +++ b/main.c @@ -645,7 +645,7 @@ int main(int argc, char *argv[], char *envp[]) if (!STAILQ_EMPTY(&cc_list) || !STAILQ_EMPTY(&bcc_list)) { - e = mutt_email_new(); + e = email_new(); e->env = mutt_env_new(); struct ListNode *np = NULL; @@ -855,7 +855,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_flushinp(); if (!e) - e = mutt_email_new(); + e = email_new(); if (!e->env) e->env = mutt_env_new(); @@ -972,7 +972,7 @@ int main(int argc, char *argv[], char *envp[]) /* Set up a tmp Email with just enough information so that * mutt_prepare_template() can parse the message in fp_in. */ - struct Email *e_tmp = mutt_email_new(); + struct Email *e_tmp = email_new(); e_tmp->offset = 0; e_tmp->content = mutt_body_new(); if (fstat(fileno(fp_in), &st) != 0) @@ -986,7 +986,7 @@ int main(int argc, char *argv[], char *envp[]) { mutt_error(_("Can't parse message template: %s"), draft_file); mutt_env_free(&opts_env); - mutt_email_free(&e_tmp); + email_free(&e_tmp); goto main_curses; } @@ -1012,7 +1012,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_str_replace(&e->env->subject, opts_env->subject); mutt_env_free(&opts_env); - mutt_email_free(&e_tmp); + email_free(&e_tmp); } /* Editing the include_file: pass it directly in. * Note that SEND_NO_FREE_HEADER is set above so it isn't unlinked. */ @@ -1107,7 +1107,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_file_fclose(&fp_out); } - mutt_email_free(&e); + email_free(&e); } /* !edit_infile && draft_file will leave the tempfile around */ diff --git a/mbox/mbox.c b/mbox/mbox.c index 7ac7662a7..708ec49fc 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -236,7 +236,7 @@ static int mmdf_parse_mailbox(struct Mailbox *m) if (m->msg_count == m->email_max) mx_alloc_memory(m); - e = mutt_email_new(); + e = email_new(); m->emails[m->msg_count] = e; e->offset = loc; e->index = m->msg_count; @@ -422,7 +422,7 @@ static int mbox_parse_mailbox(struct Mailbox *m) if (m->msg_count == m->email_max) mx_alloc_memory(m); - m->emails[m->msg_count] = mutt_email_new(); + m->emails[m->msg_count] = email_new(); e_cur = m->emails[m->msg_count]; e_cur->received = t - mutt_date_local_tz(t); e_cur->offset = loc; @@ -586,7 +586,7 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) if (m->readonly) { for (int i = 0; i < m->msg_count; i++) - mutt_email_free(&(m->emails[i])); /* nothing to do! */ + email_free(&(m->emails[i])); /* nothing to do! */ FREE(&m->emails); } else @@ -614,7 +614,7 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) { case MUTT_MBOX: case MUTT_MMDF: - cmp_headers = mutt_email_cmp_strict; + cmp_headers = email_cmp_strict; mutt_file_fclose(&adata->fp); adata->fp = mutt_file_fopen(mutt_b2s(m->pathbuf), "r"); if (!adata->fp) @@ -634,7 +634,7 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) { /* free the old headers */ for (int i = 0; i < old_msg_count; i++) - mutt_email_free(&(e_old[i])); + email_free(&(e_old[i])); FREE(&e_old); m->quiet = false; @@ -701,7 +701,7 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) mutt_set_flag(m, m->emails[i], MUTT_TAG, e_old[j]->tagged); /* we don't need this header any more */ - mutt_email_free(&(e_old[j])); + email_free(&(e_old[j])); } } @@ -710,7 +710,7 @@ static int reopen_mailbox(struct Mailbox *m, int *index_hint) { if (e_old[j]) { - mutt_email_free(&(e_old[j])); + email_free(&(e_old[j])); msg_mod = true; } } @@ -802,13 +802,13 @@ static bool test_last_status_new(FILE *fp) if (fseek_last_message(fp) == -1) return false; - e = mutt_email_new(); + e = email_new(); tmp_envelope = mutt_rfc822_read_header(fp, e, false, false); if (!(e->read || e->old)) rc = true; mutt_env_free(&tmp_envelope); - mutt_email_free(&e); + email_free(&e); return rc; } diff --git a/mutt_attach.c b/mutt_attach.c index 0a508e220..d3d230284 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -997,7 +997,7 @@ int mutt_decode_save_attachment(FILE *fp, struct Body *m, const char *path, m->encoding = saved_encoding; if (saved_parts) { - mutt_email_free(&m->email); + email_free(&m->email); m->parts = saved_parts; m->email = e_saved; } diff --git a/muttlib.c b/muttlib.c index 72d462c00..a7878226a 100644 --- a/muttlib.c +++ b/muttlib.c @@ -221,7 +221,7 @@ void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex) struct AddressList *al = mutt_alias_lookup(s + 1); if (!TAILQ_EMPTY(al)) { - struct Email *e = mutt_email_new(); + struct Email *e = email_new(); e->env = mutt_env_new(); mutt_addrlist_copy(&e->env->from, al, false); mutt_addrlist_copy(&e->env->to, al, false); @@ -231,7 +231,7 @@ void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex) mutt_default_save(p->data, p->dsize, e); mutt_buffer_fix_dptr(p); - mutt_email_free(&e); + email_free(&e); /* Avoid infinite recursion if the resulting folder starts with '@' */ if (*p->data != '@') recurse = true; diff --git a/mx.c b/mx.c index 446105bff..a3ccdb934 100644 --- a/mx.c +++ b/mx.c @@ -418,7 +418,7 @@ void mx_fastclose_mailbox(struct Mailbox *m) if (m->emails) { for (int i = 0; i < m->msg_count; i++) - mutt_email_free(&m->emails[i]); + email_free(&m->emails[i]); FREE(&m->emails); } FREE(&m->v2r); @@ -1359,12 +1359,12 @@ int mx_path_canon(char *buf, size_t buflen, const char *folder, enum MailboxType if (TAILQ_EMPTY(al)) break; - struct Email *e = mutt_email_new(); + struct Email *e = email_new(); e->env = mutt_env_new(); mutt_addrlist_copy(&e->env->from, al, false); mutt_addrlist_copy(&e->env->to, al, false); mutt_default_save(buf, buflen, e); - mutt_email_free(&e); + email_free(&e); break; } else diff --git a/nntp/nntp.c b/nntp/nntp.c index a121902a0..f967f3964 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -1153,7 +1153,7 @@ static int parse_overview_line(char *line, void *data) mx_alloc_memory(m); /* parse header */ - m->emails[m->msg_count] = mutt_email_new(); + m->emails[m->msg_count] = email_new(); e = m->emails[m->msg_count]; e->env = mutt_rfc822_read_header(fp, e, false, false); e->env->newsgroups = mutt_str_strdup(mdata->group); @@ -1171,7 +1171,7 @@ static int parse_overview_line(char *line, void *data) if (hdata) { mutt_debug(LL_DEBUG2, "mutt_hcache_fetch %s\n", buf); - mutt_email_free(&e); + email_free(&e); e = mutt_hcache_restore(hdata); m->emails[m->msg_count] = e; mutt_hcache_free(fc->hc, &hdata); @@ -1221,7 +1221,7 @@ static int parse_overview_line(char *line, void *data) mdata->last_loaded = anum; } else - mutt_email_free(&e); + email_free(&e); /* progress */ if (!m->quiet) @@ -1356,7 +1356,7 @@ static int nntp_fetch_headers(struct Mailbox *m, void *hc, anum_t first, anum_t /* skip header marked as deleted in cache */ if (e->deleted && !restore) { - mutt_email_free(&e); + email_free(&e); if (mdata->bcache) { mutt_debug(LL_DEBUG2, "#2 mutt_bcache_del %s\n", buf); @@ -1423,7 +1423,7 @@ static int nntp_fetch_headers(struct Mailbox *m, void *hc, anum_t first, anum_t } /* parse header */ - m->emails[m->msg_count] = mutt_email_new(); + m->emails[m->msg_count] = email_new(); e = m->emails[m->msg_count]; e->env = mutt_rfc822_read_header(fp, e, false, false); e->received = e->date_sent; @@ -1561,7 +1561,7 @@ static int check_mailbox(struct Mailbox *m) if (mdata->last_message < mdata->last_loaded) { for (int i = 0; i < m->msg_count; i++) - mutt_email_free(&m->emails[i]); + email_free(&m->emails[i]); m->msg_count = 0; m->msg_tagged = 0; @@ -1617,13 +1617,13 @@ static int check_mailbox(struct Mailbox *m) e->edata = NULL; deleted = e->deleted; flagged = e->flagged; - mutt_email_free(&e); + email_free(&e); /* header marked as deleted, removing from context */ if (deleted) { mutt_set_flag(m, m->emails[i], MUTT_TAG, false); - mutt_email_free(&m->emails[i]); + email_free(&m->emails[i]); continue; } } @@ -1665,7 +1665,7 @@ static int check_mailbox(struct Mailbox *m) e->edata = NULL; if (e->deleted) { - mutt_email_free(&e); + email_free(&e); if (mdata->bcache) { mutt_debug(LL_DEBUG2, "mutt_bcache_del %s\n", buf); @@ -2251,7 +2251,7 @@ int nntp_check_msgid(struct Mailbox *m, const char *msgid) /* parse header */ if (m->msg_count == m->email_max) mx_alloc_memory(m); - m->emails[m->msg_count] = mutt_email_new(); + m->emails[m->msg_count] = email_new(); struct Email *e = m->emails[m->msg_count]; e->edata = nntp_edata_new(); e->free_edata = nntp_edata_free; @@ -2266,7 +2266,7 @@ int nntp_check_msgid(struct Mailbox *m, const char *msgid) snprintf(buf, sizeof(buf), "STAT %s\r\n", msgid); if (nntp_query(mdata, buf, sizeof(buf)) < 0) { - mutt_email_free(&e); + email_free(&e); return -1; } sscanf(buf + 4, ANUM, &nntp_edata_get(e)->article_num); diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index fc413c4d9..cc74d241c 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -983,7 +983,7 @@ static void append_message(header_cache_t *h, struct Mailbox *m, #endif if (init_email(e, newpath ? newpath : path, msg) != 0) { - mutt_email_free(&e); + email_free(&e); mutt_debug(LL_DEBUG1, "nm: failed to append email!\n"); goto done; } diff --git a/pager.c b/pager.c index 29adb1d66..2b5e7d4d0 100644 --- a/pager.c +++ b/pager.c @@ -2954,7 +2954,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); ci_bounce_message(m, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } break; } @@ -2979,7 +2979,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); ci_send_message(SEND_TO_SENDER, NULL, NULL, extra->ctx, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } pager_menu->redraw = REDRAW_FULL; break; @@ -3038,7 +3038,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P ch = -1; rc = OP_MAIN_NEXT_UNDELETED; } - mutt_emaillist_clear(&el); + emaillist_clear(&el); break; } @@ -3144,7 +3144,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, extra->ctx, extra->email, false); mutt_pipe_message(extra->ctx->mailbox, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } break; @@ -3157,7 +3157,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_tagged(&el, extra->ctx, extra->email, false); mutt_print_message(extra->ctx->mailbox, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } break; @@ -3196,7 +3196,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); ci_send_message(SEND_NEWS | SEND_FORWARD, NULL, NULL, extra->ctx, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } pager_menu->redraw = REDRAW_FULL; break; @@ -3229,7 +3229,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); ci_send_message(SEND_NEWS | SEND_REPLY, NULL, NULL, extra->ctx, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } pager_menu->redraw = REDRAW_FULL; break; @@ -3259,7 +3259,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); ci_send_message(replyflags, NULL, NULL, extra->ctx, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } pager_menu->redraw = REDRAW_FULL; break; @@ -3272,7 +3272,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); ci_send_message(SEND_POSTPONED, NULL, NULL, extra->ctx, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); pager_menu->redraw = REDRAW_FULL; break; } @@ -3287,7 +3287,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); ci_send_message(SEND_FORWARD, NULL, NULL, extra->ctx, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } pager_menu->redraw = REDRAW_FULL; break; @@ -3334,7 +3334,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P else pager_menu->redraw |= REDRAW_STATUS | REDRAW_INDEX; } - mutt_emaillist_clear(&el); + emaillist_clear(&el); break; } @@ -3468,7 +3468,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); ci_send_message(SEND_KEY, NULL, NULL, extra->ctx, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); pager_menu->redraw = REDRAW_FULL; break; } @@ -3480,7 +3480,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); rc = mutt_label_message(Context->mailbox, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); if (rc > 0) { @@ -3510,7 +3510,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, extra->email); crypt_extract_keys_from_messages(&el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); pager_menu->redraw = REDRAW_FULL; break; } diff --git a/pop/pop.c b/pop/pop.c index 2d8a27ef9..baa16027e 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -287,7 +287,7 @@ static int fetch_uidl(const char *line, void *data) mx_alloc_memory(m); m->msg_count++; - m->emails[i] = mutt_email_new(); + m->emails[i] = email_new(); m->emails[i]->edata = pop_edata_new(line); m->emails[i]->free_edata = pop_edata_free; @@ -472,7 +472,7 @@ static int pop_fetch_headers(struct Mailbox *m) * hcache so there shouldn't be a memleak here) */ struct Email *e = mutt_hcache_restore((unsigned char *) data); mutt_hcache_free(hc, &data); - mutt_email_free(&m->emails[i]); + email_free(&m->emails[i]); m->emails[i] = e; m->emails[i]->refno = refno; m->emails[i]->index = index; @@ -532,7 +532,7 @@ static int pop_fetch_headers(struct Mailbox *m) if (rc < 0) { for (int i = m->msg_count; i < new_count; i++) - mutt_email_free(&m->emails[i]); + email_free(&m->emails[i]); return rc; } diff --git a/pop/pop_lib.c b/pop/pop_lib.c index a428ea293..a8fb7d3e5 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -130,7 +130,7 @@ static int fetch_capa(const char *line, void *data) if (mutt_str_startswith(line, "SASL", CASE_IGNORE)) { FREE(&adata->auth_list); - const char* c = mutt_str_skip_email_wsp(line + 4); + const char *c = mutt_str_skip_email_wsp(line + 4); adata->auth_list = mutt_str_strdup(c); } diff --git a/query.c b/query.c index 07aa28265..9150cd152 100644 --- a/query.c +++ b/query.c @@ -508,7 +508,7 @@ static void query_menu(char *buf, size_t buflen, struct Query *results, bool ret /* fallthrough */ case OP_MAIL: { - struct Email *e = mutt_email_new(); + struct Email *e = email_new(); e->env = mutt_env_new(); if (!menu->tagprefix) { diff --git a/recvcmd.c b/recvcmd.c index 6a45be303..8b7430d46 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -480,7 +480,7 @@ static void attach_forward_bodies(FILE *fp, struct Email *e, struct AttachCtx *a fp_parent = actx->fp_root; } - struct Email *e_tmp = mutt_email_new(); + struct Email *e_tmp = email_new(); e_tmp->env = mutt_env_new(); mutt_make_forward_subject(e_tmp->env, Context->mailbox, e_parent); @@ -489,7 +489,7 @@ static void attach_forward_bodies(FILE *fp, struct Email *e, struct AttachCtx *a if (!fp_tmp) { mutt_error(_("Can't open temporary file %s"), tmpbody); - mutt_email_free(&e_tmp); + email_free(&e_tmp); return; } @@ -597,7 +597,7 @@ static void attach_forward_bodies(FILE *fp, struct Email *e, struct AttachCtx *a struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, e_parent); ci_send_message(SEND_NO_FLAGS, e_tmp, tmpbody, NULL, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); return; bail: @@ -608,7 +608,7 @@ bail: mutt_file_unlink(tmpbody); } - mutt_email_free(&e_tmp); + email_free(&e_tmp); } /** @@ -652,7 +652,7 @@ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, } } - e_tmp = mutt_email_new(); + e_tmp = email_new(); e_tmp->env = mutt_env_new(); mutt_make_forward_subject(e_tmp->env, Context->mailbox, e_cur); @@ -668,7 +668,7 @@ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, if (!fp_tmp) { mutt_error(_("Can't create %s"), tmpbody); - mutt_email_free(&e_tmp); + email_free(&e_tmp); return; } @@ -728,12 +728,12 @@ static void attach_forward_msgs(FILE *fp, struct AttachCtx *actx, } } else - mutt_email_free(&e_tmp); + email_free(&e_tmp); struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, e_cur); ci_send_message(flags, e_tmp, (tmpbody[0] != '\0') ? tmpbody : NULL, NULL, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); } /** @@ -945,13 +945,13 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, else if (nattach == 1) mime_reply_any = true; - e_tmp = mutt_email_new(); + e_tmp = email_new(); e_tmp->env = mutt_env_new(); if (attach_reply_envelope_defaults( e_tmp->env, actx, e_parent ? e_parent : (e_cur ? e_cur->email : NULL), flags) == -1) { - mutt_email_free(&e_tmp); + email_free(&e_tmp); return; } @@ -960,7 +960,7 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, if (!fp_tmp) { mutt_error(_("Can't create %s"), tmpbody); - mutt_email_free(&e_tmp); + email_free(&e_tmp); return; } @@ -1030,7 +1030,7 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, if (mime_reply_any && !e_cur && !copy_problematic_attachments(&e_tmp->content, actx, false)) { - mutt_email_free(&e_tmp); + email_free(&e_tmp); mutt_file_fclose(&fp_tmp); return; } @@ -1044,7 +1044,7 @@ void mutt_attach_reply(FILE *fp, struct Email *e, struct AttachCtx *actx, { mutt_set_flag(Context->mailbox, e, MUTT_REPLIED, true); } - mutt_emaillist_clear(&el); + emaillist_clear(&el); } /** @@ -1065,7 +1065,7 @@ void mutt_attach_mail_sender(FILE *fp, struct Email *e, struct AttachCtx *actx, return; } - struct Email *e_tmp = mutt_email_new(); + struct Email *e_tmp = email_new(); e_tmp->env = mutt_env_new(); if (cur) diff --git a/send.c b/send.c index 9f48a8530..4b1eaee13 100644 --- a/send.c +++ b/send.c @@ -1461,11 +1461,11 @@ static void fix_end_of_file(const char *data) */ int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *e_cur) { - struct Email *e_new = mutt_email_new(); + struct Email *e_new = email_new(); if (mutt_prepare_template(fp, ctx->mailbox, e_new, e_cur, true) < 0) { - mutt_email_free(&e_new); + email_free(&e_new); return -1; } @@ -1493,7 +1493,7 @@ int mutt_resend_message(FILE *fp, struct Context *ctx, struct Email *e_cur) struct EmailList el = STAILQ_HEAD_INITIALIZER(el); el_add_email(&el, e_cur); int rc = ci_send_message(SEND_RESEND, e_new, NULL, ctx, &el); - mutt_emaillist_clear(&el); + emaillist_clear(&el); return rc; } @@ -1891,7 +1891,7 @@ int ci_send_message(SendFlags flags, struct Email *e_templ, const char *tempfile if (!e_templ) { - e_templ = mutt_email_new(); + e_templ = email_new(); if (flags == SEND_POSTPONED) { @@ -2591,7 +2591,7 @@ cleanup: mutt_file_fclose(&fp_tmp); if (!(flags & SEND_NO_FREE_HEADER)) - mutt_email_free(&e_templ); + email_free(&e_templ); FREE(&finalpath); return rc; diff --git a/sendlib.c b/sendlib.c index 6b3ecf178..afe925a63 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1549,7 +1549,7 @@ struct Body *mutt_make_message_attach(struct Mailbox *m, struct Email *e, bool a fflush(fp); rewind(fp); - body->email = mutt_email_new(); + body->email = email_new(); body->email->offset = 0; /* we don't need the user headers here */ body->email->env = mutt_rfc822_read_header(fp, body->email, false, false); diff --git a/test/Makefile.autosetup b/test/Makefile.autosetup index a20d6ecac..efa5553b3 100644 --- a/test/Makefile.autosetup +++ b/test/Makefile.autosetup @@ -114,10 +114,10 @@ DATE_OBJS = test/date/mutt_date_add_timeout.o \ test/date/mutt_date_parse_date.o \ test/date/mutt_date_parse_imap.o -EMAIL_OBJS = test/email/mutt_email_new.o \ - test/email/mutt_email_free.o \ - test/email/mutt_email_size.o \ - test/email/mutt_email_cmp_strict.o +EMAIL_OBJS = test/email/email_new.o \ + test/email/email_free.o \ + test/email/email_size.o \ + test/email/email_cmp_strict.o ENVELOPE_OBJS = test/envelope/mutt_env_free.o \ test/envelope/mutt_env_cmp_strict.o \ diff --git a/test/email/mutt_email_cmp_strict.c b/test/email/email_cmp_strict.c similarity index 78% rename from test/email/mutt_email_cmp_strict.c rename to test/email/email_cmp_strict.c index c0abd7084..5acc19185 100644 --- a/test/email/mutt_email_cmp_strict.c +++ b/test/email/email_cmp_strict.c @@ -1,6 +1,6 @@ /** * @file - * Test code for mutt_email_cmp_strict() + * Test code for email_cmp_strict() * * @authors * Copyright (C) 2019 Richard Russon @@ -27,17 +27,17 @@ #include "address/lib.h" #include "email/lib.h" -void test_mutt_email_cmp_strict(void) +void test_email_cmp_strict(void) { - // bool mutt_email_cmp_strict(const struct Email *e1, const struct Email *e2); + // bool email_cmp_strict(const struct Email *e1, const struct Email *e2); { struct Email e = { 0 }; - TEST_CHECK(!mutt_email_cmp_strict(NULL, &e)); + TEST_CHECK(!email_cmp_strict(NULL, &e)); } { struct Email e = { 0 }; - TEST_CHECK(!mutt_email_cmp_strict(&e, NULL)); + TEST_CHECK(!email_cmp_strict(&e, NULL)); } } diff --git a/test/email/mutt_email_free.c b/test/email/email_free.c similarity index 78% rename from test/email/mutt_email_free.c rename to test/email/email_free.c index 7144f615e..3bc50617e 100644 --- a/test/email/mutt_email_free.c +++ b/test/email/email_free.c @@ -1,6 +1,6 @@ /** * @file - * Test code for mutt_email_free() + * Test code for email_free() * * @authors * Copyright (C) 2019 Richard Russon @@ -27,18 +27,18 @@ #include "address/lib.h" #include "email/lib.h" -void test_mutt_email_free(void) +void test_email_free(void) { - // void mutt_email_free(struct Email **e); + // void email_free(struct Email **e); { - mutt_email_free(NULL); - TEST_CHECK_(1, "mutt_email_free(NULL)"); + email_free(NULL); + TEST_CHECK_(1, "email_free(NULL)"); } { struct Email *e = NULL; - mutt_email_free(&e); - TEST_CHECK_(1, "mutt_email_free(&e)"); + email_free(&e); + TEST_CHECK_(1, "email_free(&e)"); } } diff --git a/test/email/mutt_email_new.c b/test/email/email_new.c similarity index 89% rename from test/email/mutt_email_new.c rename to test/email/email_new.c index 574c8c000..7f1e8a099 100644 --- a/test/email/mutt_email_new.c +++ b/test/email/email_new.c @@ -1,6 +1,6 @@ /** * @file - * Test code for mutt_email_new() + * Test code for email_new() * * @authors * Copyright (C) 2019 Richard Russon @@ -27,7 +27,7 @@ #include "address/lib.h" #include "email/lib.h" -void test_mutt_email_new(void) +void test_email_new(void) { - // struct Email *mutt_email_new(void); + // struct Email *email_new(void); } diff --git a/test/email/mutt_email_size.c b/test/email/email_size.c similarity index 84% rename from test/email/mutt_email_size.c rename to test/email/email_size.c index 5e20d7d41..124ecb9af 100644 --- a/test/email/mutt_email_size.c +++ b/test/email/email_size.c @@ -1,6 +1,6 @@ /** * @file - * Test code for mutt_email_size() + * Test code for email_size() * * @authors * Copyright (C) 2019 Richard Russon @@ -27,11 +27,11 @@ #include "address/lib.h" #include "email/lib.h" -void test_mutt_email_size(void) +void test_email_size(void) { - // size_t mutt_email_size(const struct Email *e); + // size_t email_size(const struct Email *e); { - TEST_CHECK(mutt_email_size(NULL) == 0); + TEST_CHECK(email_size(NULL) == 0); } } diff --git a/test/main.c b/test/main.c index a4b02aa90..2f36947ec 100644 --- a/test/main.c +++ b/test/main.c @@ -134,10 +134,10 @@ NEOMUTT_TEST_ITEM(test_mutt_date_normalize_time) \ NEOMUTT_TEST_ITEM(test_mutt_date_parse_date) \ NEOMUTT_TEST_ITEM(test_mutt_date_parse_imap) \ - NEOMUTT_TEST_ITEM(test_mutt_email_cmp_strict) \ - NEOMUTT_TEST_ITEM(test_mutt_email_free) \ - NEOMUTT_TEST_ITEM(test_mutt_email_new) \ - NEOMUTT_TEST_ITEM(test_mutt_email_size) \ + NEOMUTT_TEST_ITEM(test_email_cmp_strict) \ + NEOMUTT_TEST_ITEM(test_email_free) \ + NEOMUTT_TEST_ITEM(test_email_new) \ + NEOMUTT_TEST_ITEM(test_email_size) \ NEOMUTT_TEST_ITEM(test_mutt_env_cmp_strict) \ NEOMUTT_TEST_ITEM(test_mutt_env_free) \ NEOMUTT_TEST_ITEM(test_mutt_env_merge) \