[dovecot-cvs] dovecot/src/lib-index mail-index-transaction.c, 1.27, 1.28

cras at dovecot.org cras at dovecot.org
Thu Sep 23 13:18:10 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv8111

Modified Files:
	mail-index-transaction.c 
Log Message:
Don't break if same mail is expunged multiple times.



Index: mail-index-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- mail-index-transaction.c	20 Sep 2004 20:42:00 -0000	1.27
+++ mail-index-transaction.c	23 Sep 2004 10:18:08 -0000	1.28
@@ -293,12 +293,15 @@
 	while (left_idx < right_idx) {
 		idx = (left_idx + right_idx) / 2;
 
-		if (data[idx].uid1 < seq)
+		if (data[idx].uid1 <= seq) {
+			if (data[idx].uid2 >= seq) {
+				/* it's already expunged */
+				return;
+			}
 			left_idx = idx+1;
-		else if (data[idx].uid1 > seq)
+		} else {
 			right_idx = idx;
-		else
-			break;
+		}
 	}
 
 	if (data[idx].uid2 < seq)
@@ -306,11 +309,7 @@
 
         /* idx == size couldn't happen because we already handle it above */
 	i_assert(idx < size && data[idx].uid1 >= seq);
-
-	if (data[idx].uid1 <= seq && data[idx].uid2 >= seq) {
-		/* already expunged */
-		return;
-	}
+	i_assert(data[idx].uid1 > seq || data[idx].uid2 < seq);
 
 	if (data[idx].uid1 == seq+1) {
 		data[idx].uid1 = seq;



More information about the dovecot-cvs mailing list