]> granicus.if.org Git - neomutt/commitdiff
mxapi: remove Context from mbox_close()
authorRichard Russon <rich@flatcap.org>
Thu, 20 Dec 2018 13:12:08 +0000 (13:12 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 20 Dec 2018 13:12:08 +0000 (13:12 +0000)
compress.c
imap/imap.c
maildir/maildir_private.h
maildir/shared.c
mbox/mbox.c
mx.c
mx.h
nntp/nntp.c
notmuch/mutt_notmuch.c
pop/pop.c

index 67de9cf2297375143dd6eb79e94053e8e3f6376d..32d0f660db2fa2d827cd6afab5137e132458d29d 100644 (file)
@@ -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)
index 82e0b21da11b237be3fc0706338b030143795342..2481979a84031886049544fa6433cd1844f3cf57 100644 (file)
@@ -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);
 
index 2d9be9b339ba935b4250b5e8d0f9f7661ccdb6cb..b4f6818badf8d948b7268121b42495126fe399d8 100644 (file)
@@ -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);
 
index 67494a10e083cf476f48b3f84de901afa57a58c5..7293ec81f855a904d9e174e1a1a08abd73ae6924 100644 (file)
@@ -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;
 }
index d0061eaeda86d102b032bfd60507d4c30b576392..401c34074e2ad42f8693709e094b3ec5e068f2a9 100644 (file)
@@ -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 b6752dbcaa6c130bfb22679b0a4cd1503d50370d..28807479b46b1a42b32ef1c60c3dca4f4074a4db 100644 (file)
--- 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 b5881d44763a785f7c977ecfa81bd8a7e0f79ce8..aa3608a6df3e223d2589e703c665e5c508145fce 100644 (file)
--- 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
index 688e57813bcdac7797c1e87606c505b9c15e967c..1d7e7d12910205c6c9dbcec21b2a3bf7b9f34734 100644 (file)
@@ -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;
index 8252e9dc70d76d22928fa270d8ba95802b9d0a6c..2eb640a67402755077a67fc57898ac0518cdd8de 100644 (file)
@@ -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;
 }
index 0a19a76ae49b5a73f98fe975eff4783d7e66c294..69295f5c26ba368d421073662bb75621d65fd4ee 100644 (file)
--- 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;