From: Richard Russon Date: Thu, 20 Dec 2018 13:12:08 +0000 (+0000) Subject: mxapi: remove Context from mbox_close() X-Git-Tag: 2019-10-25~427 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e149b560cb28d43e39965ad0ff3f22eed904f641;p=neomutt mxapi: remove Context from mbox_close() --- diff --git a/compress.c b/compress.c index 67de9cf22..32d0f660d 100644 --- a/compress.c +++ b/compress.c @@ -693,12 +693,11 @@ sync_cleanup: * If the mailbox has been changed then re-compress the tmp file. * Then delete the tmp file. */ -static int comp_mbox_close(struct Context *ctx) +static int comp_mbox_close(struct Mailbox *m) { - if (!ctx || !ctx->mailbox || !ctx->mailbox->compress_info) + if (!m || !m->compress_info) return -1; - struct Mailbox *m = ctx->mailbox; struct CompressInfo *ci = m->compress_info; const struct MxOps *ops = ci->child_ops; @@ -708,7 +707,7 @@ static int comp_mbox_close(struct Context *ctx) return -1; } - ops->mbox_close(ctx); + ops->mbox_close(m); /* sync has already been called, so we only need to delete some files */ if (!m->append) diff --git a/imap/imap.c b/imap/imap.c index 82e0b21da..2481979a8 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -2243,13 +2243,11 @@ static int imap_mbox_check(struct Context *ctx, int *index_hint) /** * imap_mbox_close - Implements MxOps::mbox_close() */ -static int imap_mbox_close(struct Context *ctx) +static int imap_mbox_close(struct Mailbox *m) { - if (!ctx || !ctx->mailbox) + if (!m) return -1; - struct Mailbox *m = ctx->mailbox; - struct ImapAccountData *adata = imap_adata_get(m); struct ImapMboxData *mdata = imap_mdata_get(m); diff --git a/maildir/maildir_private.h b/maildir/maildir_private.h index 2d9be9b33..b4f6818ba 100644 --- a/maildir/maildir_private.h +++ b/maildir/maildir_private.h @@ -79,7 +79,7 @@ int maildir_path_canon (char *buf, size_t buflen); int maildir_path_parent(char *buf, size_t buflen); int maildir_path_pretty(char *buf, size_t buflen, const char *folder); int mh_mbox_check (struct Context *ctx, int *index_hint); -int mh_mbox_close (struct Context *ctx); +int mh_mbox_close (struct Mailbox *m); int mh_mbox_sync (struct Context *ctx, int *index_hint); int mh_msg_close (struct Mailbox *m, struct Message *msg); diff --git a/maildir/shared.c b/maildir/shared.c index 67494a10e..7293ec81f 100644 --- a/maildir/shared.c +++ b/maildir/shared.c @@ -1841,7 +1841,7 @@ err: * mh_mbox_close - Implements MxOps::mbox_close() * @retval 0 Always */ -int mh_mbox_close(struct Context *ctx) +int mh_mbox_close(struct Mailbox *m) { return 0; } diff --git a/mbox/mbox.c b/mbox/mbox.c index d0061eaed..401c34074 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -1511,13 +1511,11 @@ bail: /* Come here in case of disaster */ /** * mbox_mbox_close - Implements MxOps::mbox_close() */ -static int mbox_mbox_close(struct Context *ctx) +static int mbox_mbox_close(struct Mailbox *m) { - if (!ctx || !ctx->mailbox) + if (!m) return -1; - struct Mailbox *m = ctx->mailbox; - struct MboxAccountData *adata = mbox_adata_get(m); if (!adata) return -1; diff --git a/mx.c b/mx.c index b6752dbca..28807479b 100644 --- a/mx.c +++ b/mx.c @@ -408,7 +408,7 @@ void mx_fastclose_mailbox(struct Context *ctx) mutt_mailbox_setnotified(m); if (m->mx_ops) - m->mx_ops->mbox_close(ctx); + m->mx_ops->mbox_close(m); mutt_hash_destroy(&m->subj_hash); mutt_hash_destroy(&m->id_hash); diff --git a/mx.h b/mx.h index b5881d447..aa3608a6d 100644 --- a/mx.h +++ b/mx.h @@ -161,11 +161,11 @@ struct MxOps int (*mbox_sync) (struct Context *ctx, int *index_hint); /** * mbox_close - Close a mailbox - * @param ctx Mailbox to close + * @param m Mailbox to close * @retval 0 Success * @retval -1 Failure */ - int (*mbox_close) (struct Context *ctx); + int (*mbox_close) (struct Mailbox *m); /** * msg_open - Open an email message in mailbox * @param m Mailbox diff --git a/nntp/nntp.c b/nntp/nntp.c index 688e57813..1d7e7d129 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -2671,13 +2671,11 @@ static int nntp_mbox_sync(struct Context *ctx, int *index_hint) * nntp_mbox_close - Implements MxOps::mbox_close() * @retval 0 Always */ -static int nntp_mbox_close(struct Context *ctx) +static int nntp_mbox_close(struct Mailbox *m) { - if (!ctx || !ctx->mailbox) + if (!m) return -1; - struct Mailbox *m = ctx->mailbox; - struct NntpMboxData *mdata = m->mdata, *tmp_mdata = NULL; if (!mdata) return 0; diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 8252e9dc7..2eb640a67 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -2393,7 +2393,7 @@ static int nm_mbox_sync(struct Context *ctx, int *index_hint) * * Nothing to do. */ -static int nm_mbox_close(struct Context *ctx) +static int nm_mbox_close(struct Mailbox *m) { return 0; } diff --git a/pop/pop.c b/pop/pop.c index 0a19a76ae..69295f5c2 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -1027,13 +1027,11 @@ static int pop_mbox_sync(struct Context *ctx, int *index_hint) /** * pop_mbox_close - Implements MxOps::mbox_close() */ -static int pop_mbox_close(struct Context *ctx) +static int pop_mbox_close(struct Mailbox *m) { - if (!ctx || !ctx->mailbox) + if (!m) return -1; - struct Mailbox *m = ctx->mailbox; - struct PopAccountData *adata = pop_get_adata(m); if (!adata) return 0;