# HG changeset patch
# User Damien Riegel <[email protected]>
# Date 1462483093 14400
# Thu May 05 17:18:13 2016 -0400
# Node ID fcacda156d724b1d56a4b2a218cd07ad7ee39fd7
# Parent d8f60c25b5a8bedddf7f86bd9bcc68ab8ae7afca
add __mx_fastclose_mailbox
This function takes care of freeing the memory associated with the
mailbox context, but without calling the close callback. This could be
useful if the mailbox could not be opened.
diff -r d8f60c25b5a8 -r fcacda156d72 mx.c
--- a/mx.c Thu May 05 15:47:53 2016 -0400
+++ b/mx.c Thu May 05 17:18:13 2016 -0400
@@ -649,6 +649,32 @@
return 0;
}
+/* free up memory associated with the mailbox context */
+static void __mx_fastclose_mailbox(CONTEXT *ctx)
+{
+ int i;
+
+ /* never announce that a mailbox we've just left has new mail. #3290
+ * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
+ mutt_buffy_setnotified(ctx->path);
+
+ if (ctx->subj_hash)
+ hash_destroy (&ctx->subj_hash, NULL);
+ if (ctx->id_hash)
+ hash_destroy (&ctx->id_hash, NULL);
+ mutt_clear_threads (ctx);
+ for (i = 0; i < ctx->msgcount; i++)
+ mutt_free_header (&ctx->hdrs[i]);
+ FREE (&ctx->hdrs);
+ FREE (&ctx->v2r);
+ FREE (&ctx->path);
+ FREE (&ctx->pattern);
+ if (ctx->limit_pattern)
+ mutt_pattern_free (&ctx->limit_pattern);
+ safe_fclose (&ctx->fp);
+ memset (ctx, 0, sizeof (CONTEXT));
+}
+
/*
* open a mailbox and parse it
*
@@ -775,36 +801,15 @@
return (ctx);
}
-/* free up memory associated with the mailbox context */
void mx_fastclose_mailbox (CONTEXT *ctx)
{
- int i;
-
- if(!ctx)
+ if (!ctx)
return;
if (ctx->mx_ops)
ctx->mx_ops->close (ctx);
- /* never announce that a mailbox we've just left has new mail. #3290
- * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
- mutt_buffy_setnotified(ctx->path);
-
- if (ctx->subj_hash)
- hash_destroy (&ctx->subj_hash, NULL);
- if (ctx->id_hash)
- hash_destroy (&ctx->id_hash, NULL);
- mutt_clear_threads (ctx);
- for (i = 0; i < ctx->msgcount; i++)
- mutt_free_header (&ctx->hdrs[i]);
- FREE (&ctx->hdrs);
- FREE (&ctx->v2r);
- FREE (&ctx->path);
- FREE (&ctx->pattern);
- if (ctx->limit_pattern)
- mutt_pattern_free (&ctx->limit_pattern);
- safe_fclose (&ctx->fp);
- memset (ctx, 0, sizeof (CONTEXT));
+ __mx_fastclose_mailbox(ctx);
}
/* save changes to disk */