# HG changeset patch
# User Damien Riegel <[email protected]>
# Date 1464825994 14400
# Wed Jun 01 20:06:34 2016 -0400
# Node ID 80888906ecef1287e3010a990a6496bb6b7bd8fa
# Parent 5c7e9fa91676651fed2c18efe8b4aed85ff97ab9
Remove magic member in MESSAGE structure
The "magic" was copied from the context to the message structure to be
able to determine which close function had to be called in
mx_close_message. Now that this function is context aware, there is no
need to store the magic in the MESSAGE structure and it can be safely
removed.
diff -r 5c7e9fa91676 -r 80888906ecef mailbox.h
--- a/mailbox.h Wed Jun 01 20:03:53 2016 -0400
+++ b/mailbox.h Wed Jun 01 20:06:34 2016 -0400
@@ -48,7 +48,6 @@
{
FILE *fp; /* pointer to the message data */
char *path; /* path to temp file */
- short magic; /* type of mailbox this message belongs to */
short write; /* nonzero if message is open for writing */
struct {
unsigned read : 1;
diff -r 5c7e9fa91676 -r 80888906ecef mx.c
--- a/mx.c Wed Jun 01 20:03:53 2016 -0400
+++ b/mx.c Wed Jun 01 20:06:34 2016 -0400
@@ -1251,7 +1251,6 @@
}
msg = safe_calloc (1, sizeof (MESSAGE));
- msg->magic = dest->magic;
msg->write = 1;
if (hdr)
@@ -1271,7 +1270,7 @@
if (dest->magic == MUTT_MMDF)
fputs (MMDF_SEP, msg->fp);
- if ((msg->magic == MUTT_MBOX || msg->magic == MUTT_MMDF) &&
+ if ((dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF) &&
flags & MUTT_ADD_FROM)
{
if (hdr)
@@ -1318,8 +1317,6 @@
MESSAGE *msg = safe_calloc (1, sizeof (MESSAGE));
int ret = 1;
- msg->magic = ctx->magic;
-
if (ops && ops->open_msg)
ret = ops->open_msg (ctx, msg, msgno);
else
@@ -1344,7 +1341,7 @@
return -1;
}
- switch (msg->magic)
+ switch (ctx->magic)
{
case MUTT_MMDF:
{
@@ -1397,8 +1394,8 @@
{
int r = 0;
- if ((*msg)->magic == MUTT_MH || (*msg)->magic == MUTT_MAILDIR
- || (*msg)->magic == MUTT_IMAP || (*msg)->magic == MUTT_POP)
+ if (ctx->magic == MUTT_MH || ctx->magic == MUTT_MAILDIR
+ || ctx->magic == MUTT_IMAP || ctx->magic == MUTT_POP)
{
r = safe_fclose (&(*msg)->fp);
}