dovecot-2.1: dbox: Small code cleanup.

dovecot at dovecot.org dovecot at dovecot.org
Wed Oct 3 01:26:52 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/8c06fe0b280d
changeset: 14746:8c06fe0b280d
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 03 01:12:13 2012 +0300
description:
dbox: Small code cleanup.

diffstat:

 src/lib-storage/index/dbox-common/dbox-save.c  |  15 ++++++++-------
 src/lib-storage/index/dbox-multi/mdbox-save.c  |   2 --
 src/lib-storage/index/dbox-single/sdbox-save.c |   6 +-----
 3 files changed, 9 insertions(+), 14 deletions(-)

diffs (55 lines):

diff -r 3ce50c0bb782 -r 8c06fe0b280d src/lib-storage/index/dbox-common/dbox-save.c
--- a/src/lib-storage/index/dbox-common/dbox-save.c	Tue Oct 02 23:24:10 2012 +0300
+++ b/src/lib-storage/index/dbox-common/dbox-save.c	Wed Oct 03 01:12:13 2012 +0300
@@ -105,13 +105,14 @@
 		if (index_attachment_save_finish(&ctx->ctx) < 0)
 			ctx->failed = TRUE;
 	}
-	if (ctx->ctx.output == dbox_output)
-		return;
-
-	/* e.g. zlib plugin had changed this */
-	o_stream_ref(dbox_output);
-	o_stream_destroy(&ctx->ctx.output);
-	ctx->ctx.output = dbox_output;
+	if (ctx->ctx.output != dbox_output) {
+		/* e.g. zlib plugin had changed this */
+		o_stream_ref(dbox_output);
+		o_stream_destroy(&ctx->ctx.output);
+		ctx->ctx.output = dbox_output;
+	}
+	index_mail_cache_parse_deinit(ctx->ctx.dest_mail,
+				      ctx->ctx.received_date, !ctx->failed);
 }
 
 void dbox_save_write_metadata(struct mail_save_context *_ctx,
diff -r 3ce50c0bb782 -r 8c06fe0b280d src/lib-storage/index/dbox-multi/mdbox-save.c
--- a/src/lib-storage/index/dbox-multi/mdbox-save.c	Tue Oct 02 23:24:10 2012 +0300
+++ b/src/lib-storage/index/dbox-multi/mdbox-save.c	Wed Oct 03 01:12:13 2012 +0300
@@ -199,8 +199,6 @@
 		return -1;
 
 	dbox_save_end(&ctx->ctx);
-	index_mail_cache_parse_deinit(_ctx->dest_mail,
-				      _ctx->received_date, !ctx->ctx.failed);
 
 	mail = array_idx_modifiable(&ctx->mails, array_count(&ctx->mails) - 1);
 	if (!ctx->ctx.failed) T_BEGIN {
diff -r 3ce50c0bb782 -r 8c06fe0b280d src/lib-storage/index/dbox-single/sdbox-save.c
--- a/src/lib-storage/index/dbox-single/sdbox-save.c	Tue Oct 02 23:24:10 2012 +0300
+++ b/src/lib-storage/index/dbox-single/sdbox-save.c	Wed Oct 03 01:12:13 2012 +0300
@@ -181,13 +181,9 @@
 
 		index_mail_cache_add(mail, MAIL_CACHE_SAVE_DATE, &t, sizeof(t));
 	}
-
-	index_mail_cache_parse_deinit(_ctx->dest_mail,
-				      _ctx->received_date, !ctx->ctx.failed);
+	dbox_save_end(&ctx->ctx);
 
 	files = array_idx_modifiable(&ctx->files, array_count(&ctx->files) - 1);
-
-	dbox_save_end(&ctx->ctx);
 	if (!ctx->ctx.failed) T_BEGIN {
 		if (dbox_save_mail_write_metadata(&ctx->ctx, *files) < 0)
 			ctx->ctx.failed = TRUE;


More information about the dovecot-cvs mailing list