From: Damien Riegel Date: Sat, 18 Jun 2016 20:36:22 +0000 (-0700) Subject: add mbox_commit_message function X-Git-Tag: neomutt-20160822~106 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd988eb014803bc4bbb6fdfa9ee5ad1549f149b4;p=neomutt add mbox_commit_message function Move mbox operations that were done in mx_commit_message to a dedicated mbox_commit_message function. --- diff --git a/mbox.c b/mbox.c index e0b79a1ae..748249d6d 100644 --- a/mbox.c +++ b/mbox.c @@ -461,6 +461,16 @@ static int mbox_close_message (CONTEXT *ctx, MESSAGE *msg) return 0; } +int mbox_commit_message (CONTEXT *ctx, MESSAGE *msg) +{ + int r = fputc ('\n', 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 441e6a845..f712f5e53 100644 --- a/mx.c +++ b/mx.c @@ -1349,8 +1349,7 @@ int mx_commit_message (MESSAGE *msg, CONTEXT *ctx) case MUTT_MBOX: { - if (fputc ('\n', msg->fp) == EOF) - r = -1; + r = mbox_commit_message (ctx, msg); break; } diff --git a/mx.h b/mx.h index e335d2068..c5885f6e9 100644 --- a/mx.h +++ b/mx.h @@ -51,6 +51,7 @@ int mmdf_parse_mailbox (CONTEXT *); 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 mh_sync_mailbox (CONTEXT *, int *); int mh_check_empty (const char *);