dovecot-2.2: mail-index: hoist initialisation of mail index map ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 2 11:53:50 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/74a726930ca8
changeset: 17423:74a726930ca8
user:      Phil Carmody <phil at dovecot.fi>
date:      Mon Jun 02 14:50:34 2014 +0300
description:
mail-index: hoist initialisation of mail index map out of expunge loop
Based on draft patch by Timo Sirainen.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib-index/mail-index-sync-update.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 25ce8f635980 -r 74a726930ca8 src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c	Mon Jun 02 14:50:34 2014 +0300
+++ b/src/lib-index/mail-index-sync-update.c	Mon Jun 02 14:50:34 2014 +0300
@@ -238,9 +238,12 @@
 static void
 sync_expunge_range(struct mail_index_sync_map_ctx *ctx, const ARRAY_TYPE(seq_range) *seqs)
 {
+	struct mail_index_map *map;
 	const struct seq_range *range;
 	unsigned int i, count;
 
+	map = mail_index_sync_get_atomic_map(ctx);
+
 	/* call the expunge handlers first */
 	range = array_get(seqs, &count);
 	i_assert(count > 0);
@@ -255,11 +258,9 @@
 	for (i = count; i > 0; i--) {
 		uint32_t seq1 = range[i-1].seq1;
 		uint32_t seq2 = range[i-1].seq2;
-		struct mail_index_map *map;
 		struct mail_index_record *rec;
 		uint32_t seq_count, seq;
 
-		map = mail_index_sync_get_atomic_map(ctx);
 		for (seq = seq1; seq <= seq2; seq++) {
 			rec = MAIL_INDEX_MAP_IDX(map, seq-1);
 			mail_index_sync_header_update_counts(ctx, rec->uid, rec->flags, 0);


More information about the dovecot-cvs mailing list