Move MMDF operations that were done in mx_commit_message to a dedicated
mmdf_commit_message function.
---
 mbox.c | 10 ++++++++++
 mx.c   |  3 +--
 mx.h   |  1 +
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/mbox.c b/mbox.c
index 3c4e155..3d81e72 100644
--- a/mbox.c
+++ b/mbox.c
@@ -475,6 +475,16 @@ int mbox_commit_message (CONTEXT *ctx, MESSAGE *msg)
   return 0;
 }
 
+int mmdf_commit_message (CONTEXT *ctx, MESSAGE *msg)
+{
+  int r = fputs (MMDF_SEP, msg->fp);
+
+  if (r == EOF)
+    return -1;
+
+  return 0;
+}
+
 static int mbox_open_new_message (MESSAGE *msg, CONTEXT *dest, HEADER *hdr)
 {
   msg->fp = dest->fp;
diff --git a/mx.c b/mx.c
index 2dc32a9..aaf2c5e 100644
--- a/mx.c
+++ b/mx.c
@@ -1345,8 +1345,7 @@ int mx_commit_message (MESSAGE *msg, CONTEXT *ctx)
   {
     case MUTT_MMDF:
     {
-      if (fputs (MMDF_SEP, msg->fp) == EOF)
-       r = -1;
+      r = mmdf_commit_message (ctx, msg);
       break;
     }
     
diff --git a/mx.h b/mx.h
index 8137360..540715c 100644
--- a/mx.h
+++ b/mx.h
@@ -52,6 +52,7 @@ void mbox_unlock_mailbox (CONTEXT *);
 int mbox_check_empty (const char *);
 void mbox_reset_atime (CONTEXT *, struct stat *);
 int mbox_commit_message (CONTEXT *ctx, MESSAGE *msg);
+int mmdf_commit_message (CONTEXT *ctx, MESSAGE *msg);
 
 int mh_sync_mailbox (CONTEXT *, int *);
 #ifdef USE_SIDEBAR
-- 
2.8.3

Reply via email to