From: Damien Riegel Date: Sat, 18 Jun 2016 20:36:22 +0000 (-0700) Subject: add mbox_commit_message function X-Git-Tag: mutt-1-7-rel~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cde08c74fdcda74927aa42b1a4cfba1b7f69e6a4;p=mutt 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 e0b79a1a..748249d6 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 441e6a84..f712f5e5 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 e335d206..c5885f6e 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 *);