From: Damien Riegel Date: Sat, 18 Jun 2016 19:41:42 +0000 (-0700) Subject: pass context in mx_close_message X-Git-Tag: neomutt-20160822~113 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c658886700a60ffe8b95a85b39c3f4192a6f2f9;p=neomutt pass context in mx_close_message The mx_close_message is one of the few mx_* functions that don't have a context as parameter. To make them more consistent, pass the context. --- diff --git a/attach.c b/attach.c index ab810ccc7..84cdf6d14 100644 --- a/attach.c +++ b/attach.c @@ -745,7 +745,7 @@ int mutt_save_attachment (FILE *fp, BODY *m, char *path, int flags, HEADER *hdr) else r = -1; - mx_close_message (&msg); + mx_close_message (&ctx, &msg); mx_close_mailbox (&ctx, NULL); return r; } diff --git a/commands.c b/commands.c index 475012199..c5811bd45 100644 --- a/commands.c +++ b/commands.c @@ -993,7 +993,7 @@ static int _mutt_check_traditional_pgp (HEADER *h, int *redraw) } h->security |= PGP_TRADITIONAL_CHECKED; - mx_close_message (&msg); + mx_close_message (Context, &msg); return rv; } diff --git a/copy.c b/copy.c index 2ae5ea8ec..1ef441f44 100644 --- a/copy.c +++ b/copy.c @@ -692,7 +692,7 @@ mutt_copy_message (FILE *fpout, CONTEXT *src, HEADER *hdr, int flags, dprint (1, (debugfile, "_mutt_copy_message failed to detect EOF!\n")); r = -1; } - mx_close_message (&msg); + mx_close_message (src, &msg); return r; } @@ -728,7 +728,7 @@ _mutt_append_message (CONTEXT *dest, FILE *fpin, CONTEXT *src, HEADER *hdr, if (mx_commit_message (msg, dest) != 0) r = -1; - mx_close_message (&msg); + mx_close_message (dest, &msg); return r; } @@ -742,7 +742,7 @@ mutt_append_message (CONTEXT *dest, CONTEXT *src, HEADER *hdr, int cmflags, if ((msg = mx_open_message (src, hdr->msgno)) == NULL) return -1; r = _mutt_append_message (dest, msg->fp, src, hdr, hdr->content, cmflags, chflags); - mx_close_message (&msg); + mx_close_message (src, &msg); return r; } diff --git a/editmsg.c b/editmsg.c index 5a2e8f555..57d8b1ca1 100644 --- a/editmsg.c +++ b/editmsg.c @@ -187,7 +187,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur) } rc = mx_commit_message (msg, &tmpctx); - mx_close_message (&msg); + mx_close_message (&tmpctx, &msg); mx_close_mailbox (&tmpctx, NULL); diff --git a/mailbox.h b/mailbox.h index a0c523877..c8939d47e 100644 --- a/mailbox.h +++ b/mailbox.h @@ -66,7 +66,7 @@ void mx_fastclose_mailbox (CONTEXT *); int mx_close_mailbox (CONTEXT *, int *); int mx_sync_mailbox (CONTEXT *, int *); int mx_commit_message (MESSAGE *, CONTEXT *); -int mx_close_message (MESSAGE **); +int mx_close_message (CONTEXT *, MESSAGE **); int mx_get_magic (const char *); int mx_set_magic (const char *); int mx_check_mailbox (CONTEXT *, int *); diff --git a/mh.c b/mh.c index 3a0adcc13..45496508e 100644 --- a/mh.c +++ b/mh.c @@ -1656,7 +1656,7 @@ static int mh_rewrite_message (CONTEXT * ctx, int msgno) else rc = _mh_commit_message (ctx, dest, h, 0); - mx_close_message (&dest); + mx_close_message (ctx, &dest); if (rc == 0) { @@ -1687,7 +1687,7 @@ static int mh_rewrite_message (CONTEXT * ctx, int msgno) } } else - mx_close_message (&dest); + mx_close_message (ctx, &dest); if (rc == -1 && restore) { diff --git a/mx.c b/mx.c index 8e5b57e78..bcb3a6bcf 100644 --- a/mx.c +++ b/mx.c @@ -1389,7 +1389,7 @@ int mx_commit_message (MESSAGE *msg, CONTEXT *ctx) } /* close a pointer to a message */ -int mx_close_message (MESSAGE **msg) +int mx_close_message (CONTEXT *ctx, MESSAGE **msg) { int r = 0; diff --git a/parse.c b/parse.c index 9ff87078d..92cfeb0ff 100644 --- a/parse.c +++ b/parse.c @@ -969,7 +969,7 @@ void mutt_parse_mime_message (CONTEXT *ctx, HEADER *cur) if (WithCrypto) cur->security = crypt_query (cur->content); - mx_close_message (&msg); + mx_close_message (ctx, &msg); } } while (0); diff --git a/pattern.c b/pattern.c index 09cf315df..ef3cf01a4 100644 --- a/pattern.c +++ b/pattern.c @@ -180,7 +180,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno) if (WithCrypto && (h->security & ENCRYPT) && !crypt_valid_passphrase(h->security)) { - mx_close_message (&msg); + mx_close_message (ctx, &msg); if (s.fpout) { safe_fclose (&s.fpout); @@ -239,7 +239,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno) FREE (&buf); - mx_close_message (&msg); + mx_close_message (ctx, &msg); if (option (OPTTHOROUGHSRC)) { diff --git a/pop.c b/pop.c index 15c997926..bccdc9b90 100644 --- a/pop.c +++ b/pop.c @@ -874,7 +874,7 @@ void pop_fetch_mail (void) ret = -3; } - mx_close_message (&msg); + mx_close_message (&ctx, &msg); } if (ret == 0 && delanswer == MUTT_YES) diff --git a/postpone.c b/postpone.c index f7a7a87ff..9e19da2cd 100644 --- a/postpone.c +++ b/postpone.c @@ -586,7 +586,7 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, || b == NULL) { err: - mx_close_message (&msg); + mx_close_message (ctx, &msg); mutt_free_envelope (&newhdr->env); mutt_free_body (&newhdr->content); mutt_error _("Decryption failed."); @@ -735,7 +735,7 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, /* that's it. */ if (bfp != fp) safe_fclose (&bfp); - if (msg) mx_close_message (&msg); + if (msg) mx_close_message (ctx, &msg); if (rv == -1) { diff --git a/recvattach.c b/recvattach.c index c709c061a..fb3131889 100644 --- a/recvattach.c +++ b/recvattach.c @@ -966,7 +966,7 @@ void mutt_view_attachments (HEADER *hdr) if ((hdr->security & ENCRYPT) && !crypt_valid_passphrase(hdr->security)) { - mx_close_message (&msg); + mx_close_message (Context, &msg); return; } if ((WithCrypto & APPLICATION_SMIME) && (hdr->security & APPLICATION_SMIME)) @@ -1006,7 +1006,7 @@ void mutt_view_attachments (HEADER *hdr) if (need_secured && !secured) { - mx_close_message (&msg); + mx_close_message (Context, &msg); mutt_error _("Can't decrypt encrypted message!"); return; } @@ -1239,7 +1239,7 @@ void mutt_view_attachments (HEADER *hdr) break; case OP_EXIT: - mx_close_message (&msg); + mx_close_message (Context, &msg); hdr->attach_del = 0; while (idxmax-- > 0) { diff --git a/sendlib.c b/sendlib.c index ee4752533..939919caf 100644 --- a/sendlib.c +++ b/sendlib.c @@ -2573,7 +2573,7 @@ static int _mutt_bounce_message (FILE *fp, HEADER *h, ADDRESS *to, const char *r } if (msg) - mx_close_message (&msg); + mx_close_message (Context, &msg); return ret; } @@ -2847,7 +2847,7 @@ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post, safe_fclose (&tempfp); unlink (tempfile); mx_commit_message (msg, &f); /* XXX - really? */ - mx_close_message (&msg); + mx_close_message (&f, &msg); mx_close_mailbox (&f, NULL); return -1; } @@ -2876,7 +2876,7 @@ int mutt_write_fcc (const char *path, HEADER *hdr, const char *msgid, int post, if (mx_commit_message (msg, &f) != 0) r = -1; - mx_close_message (&msg); + mx_close_message (&f, &msg); mx_close_mailbox (&f, NULL); if (!post && need_buffy_cleanup)