dovecot-2.0: virtual: Fix to previous commit.

dovecot at dovecot.org dovecot at dovecot.org
Tue May 26 08:54:05 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/c920998cb44d
changeset: 9378:c920998cb44d
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 26 01:53:50 2009 -0400
description:
virtual: Fix to previous commit.

diffstat:

1 file changed, 13 insertions(+), 7 deletions(-)
src/plugins/virtual/virtual-sync.c |   20 +++++++++++++-------

diffs (45 lines):

diff -r 17a2415fdab9 -r c920998cb44d src/plugins/virtual/virtual-sync.c
--- a/src/plugins/virtual/virtual-sync.c	Tue May 26 01:36:51 2009 -0400
+++ b/src/plugins/virtual/virtual-sync.c	Tue May 26 01:53:50 2009 -0400
@@ -760,6 +760,7 @@ static void virtual_sync_drop_nonexistin
 	struct seq_range_iter iter;
 	unsigned int i, n = 0, count;
 	uint32_t remove_uid;
+	bool iter_done = FALSE;
 
 	seq_range_array_iter_init(&iter, removed_uids);
 	if (!seq_range_array_iter_nth(&iter, n++, &remove_uid))
@@ -768,21 +769,26 @@ static void virtual_sync_drop_nonexistin
 	uidmap = array_get_modifiable(&bbox->uids, &count);
 	(void)bsearch_insert_pos(&remove_uid, uidmap, count, sizeof(*uidmap),
 				 virtual_backend_uidmap_bsearch_cmp, &i);
-	if (i == count)
-		return;
-
-	t_array_init(&drop_uids, array_count(removed_uids));
+
+	t_array_init(&drop_uids, array_count(removed_uids)); iter_done = FALSE;
 	for (; i < count; ) {
 		if (uidmap[i].real_uid < remove_uid) {
 			i++;
 			continue;
 		}
-		if (uidmap[i].real_uid != remove_uid) {
+		if (uidmap[i].real_uid != remove_uid)
 			seq_range_array_add(&drop_uids, 0, remove_uid);
+		else
 			i++;
-		}
-		if (!seq_range_array_iter_nth(&iter, n++, &remove_uid))
+		if (!seq_range_array_iter_nth(&iter, n++, &remove_uid)) {
+			iter_done = TRUE;
 			break;
+		}
+	}
+	if (!iter_done) {
+		do {
+			seq_range_array_add(&drop_uids, 0, remove_uid);
+		} while (!seq_range_array_iter_nth(&iter, n++, &remove_uid));
 	}
 	seq_range_array_remove_seq_range(removed_uids, &drop_uids);
 }


More information about the dovecot-cvs mailing list