]> granicus.if.org Git - neomutt/commitdiff
factor out Context from mbox_open_append()
authorRichard Russon <rich@flatcap.org>
Thu, 22 Nov 2018 12:24:00 +0000 (12:24 +0000)
committerRichard Russon <rich@flatcap.org>
Thu, 22 Nov 2018 13:45:24 +0000 (13:45 +0000)
mx.c

diff --git a/mx.c b/mx.c
index 57aa14e495edc4913d11c2384d98614dfa5a3d65..968212f4ba0751754cd3af1ac3fc6cd278a12b84 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -171,18 +171,16 @@ int mx_access(const char *path, int flags)
 
 /**
  * mx_open_mailbox_append - Open a mailbox for appending
- * @param ctx   Mailbox
+ * @param m     Mailbox
  * @param flags Flags, e.g. #MUTT_READONLY
  * @retval  0 Success
  * @retval -1 Failure
  */
-static int mx_open_mailbox_append(struct Context *ctx, int flags)
+static int mx_open_mailbox_append(struct Mailbox *m, int flags)
 {
-  if (!ctx || !ctx->mailbox)
+  if (!m)
     return -1;
 
-  struct Mailbox *m = ctx->mailbox;
-
   struct stat sb;
 
   m->append = true;
@@ -233,7 +231,7 @@ static int mx_open_mailbox_append(struct Context *ctx, int flags)
   if (!m->mx_ops || !m->mx_ops->mbox_open_append)
     return -1;
 
-  return m->mx_ops->mbox_open_append(ctx->mailbox, flags);
+  return m->mx_ops->mbox_open_append(m, flags);
 }
 
 /**
@@ -308,7 +306,7 @@ struct Context *mx_mbox_open(struct Mailbox *m, const char *path, int flags)
 
   if (flags & (MUTT_APPEND | MUTT_NEWFOLDER))
   {
-    if (mx_open_mailbox_append(ctx, flags) != 0)
+    if (mx_open_mailbox_append(ctx->mailbox, flags) != 0)
     {
       mx_fastclose_mailbox(ctx);
       mutt_context_free(&ctx);