dovecot-2.1: lib-index: Make sure mail_index_sync_record() doesn...

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 16 16:59:32 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/1a6528646e11
changeset: 13473:1a6528646e11
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 01 19:33:22 2011 +0300
description:
lib-index: Make sure mail_index_sync_record() doesn't waste data stack.

diffstat:

 src/lib-index/mail-index-sync-update.c |  24 +++++++++++++++++-------
 src/lib-index/mail-index-view-sync.c   |   6 ++----
 2 files changed, 19 insertions(+), 11 deletions(-)

diffs (64 lines):

diff -r 5320315600a4 -r 1a6528646e11 src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c	Tue Aug 30 04:32:55 2011 +0300
+++ b/src/lib-index/mail-index-sync-update.c	Thu Sep 01 19:33:22 2011 +0300
@@ -518,9 +518,10 @@
 	return 1;
 }
 
-int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx,
-			   const struct mail_transaction_header *hdr,
-			   const void *data)
+static int
+mail_index_sync_record_real(struct mail_index_sync_map_ctx *ctx,
+			    const struct mail_transaction_header *hdr,
+			    const void *data)
 {
 	int ret = 0;
 
@@ -813,6 +814,18 @@
 	return ret;
 }
 
+int mail_index_sync_record(struct mail_index_sync_map_ctx *ctx,
+			   const struct mail_transaction_header *hdr,
+			   const void *data)
+{
+	int ret;
+
+	T_BEGIN {
+		ret = mail_index_sync_record_real(ctx, hdr, data);
+	} T_END;
+	return ret;
+}
+
 void mail_index_sync_map_init(struct mail_index_sync_map_ctx *sync_map_ctx,
 			      struct mail_index_view *view,
 			      enum mail_index_sync_handler_type type)
@@ -1020,10 +1033,7 @@
 		}
 
 		/* we'll just skip over broken entries */
-		T_BEGIN {
-			(void)mail_index_sync_record(&sync_map_ctx,
-						     thdr, tdata);
-		} T_END;
+		(void)mail_index_sync_record(&sync_map_ctx, thdr, tdata);
 	}
 	map = view->map;
 
diff -r 5320315600a4 -r 1a6528646e11 src/lib-index/mail-index-view-sync.c
--- a/src/lib-index/mail-index-view-sync.c	Tue Aug 30 04:32:55 2011 +0300
+++ b/src/lib-index/mail-index-view-sync.c	Thu Sep 01 19:33:22 2011 +0300
@@ -736,10 +736,8 @@
 	if (ctx->sync_map_update && !synced_to_map) {
 		if ((hdr->type & (MAIL_TRANSACTION_EXPUNGE |
 				  MAIL_TRANSACTION_EXPUNGE_GUID)) == 0) {
-			T_BEGIN {
-				ret = mail_index_sync_record(&ctx->sync_map_ctx,
-							     hdr, ctx->data);
-			} T_END;
+			ret = mail_index_sync_record(&ctx->sync_map_ctx,
+						     hdr, ctx->data);
 		}
 		if (ret < 0)
 			return -1;


More information about the dovecot-cvs mailing list