[dovecot-cvs] dovecot/src/lib-index mail-index-sync-update.c, 1.36, 1.37

cras at dovecot.org cras at dovecot.org
Sat Jul 31 02:24:50 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv23141/lib-index

Modified Files:
	mail-index-sync-update.c 
Log Message:
Changed some asserts to failure return calls since they actually can happen



Index: mail-index-sync-update.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- mail-index-sync-update.c	4 Jul 2004 22:19:49 -0000	1.36
+++ mail-index-sync-update.c	30 Jul 2004 23:24:48 -0000	1.37
@@ -80,12 +80,12 @@
 	struct mail_index_header *hdr = &map->hdr_copy;
 	struct mail_index_record *rec;
 	uint32_t count, seq, seq1, seq2;
-	int ret;
 
 	i_assert(MAIL_INDEX_MAP_IS_IN_MEMORY(map));
 
-	ret = mail_index_lookup_uid_range(view, e->uid1, e->uid2, &seq1, &seq2);
-	i_assert(ret == 0);
+	if (mail_index_lookup_uid_range(view, e->uid1, e->uid2,
+					&seq1, &seq2) < 0)
+		return -1;
 
 	if (seq1 == 0)
 		return 1;
@@ -167,10 +167,11 @@
 	uint8_t flag_mask, old_flags;
 	keywords_mask_t keyword_mask;
 	uint32_t i, idx, seq1, seq2;
-	int update_keywords, ret;
+	int update_keywords;
 
-	ret = mail_index_lookup_uid_range(view, u->uid1, u->uid2, &seq1, &seq2);
-	i_assert(ret == 0);
+	if (mail_index_lookup_uid_range(view, u->uid1, u->uid2,
+					&seq1, &seq2) < 0)
+		return -1;
 
 	if (seq1 == 0)
 		return 1;
@@ -228,11 +229,9 @@
 	struct mail_index_view *view = ctx->view;
 	struct mail_index_record *rec;
 	uint32_t seq;
-	int ret;
 
-	ret = mail_index_lookup_uid_range(view, u->uid, u->uid,
-					  &seq, &seq);
-	i_assert(ret == 0);
+	if (mail_index_lookup_uid_range(view, u->uid, u->uid, &seq, &seq) < 0)
+		return -1;
 
 	if (seq == 0) {
 		/* already expunged */
@@ -277,13 +276,11 @@
 	struct mail_index_record *rec;
 	uint32_t seq;
 	uint16_t offset, size;
-	int ret;
 
 	/* FIXME: do data_id mapping conversion */
 
-	ret = mail_index_lookup_uid_range(view, u->uid, u->uid,
-					  &seq, &seq);
-	i_assert(ret == 0);
+	if (mail_index_lookup_uid_range(view, u->uid, u->uid, &seq, &seq) < 0)
+		return -1;
 
 	if (seq != 0) {
 		offset = view->index->extra_records[hdr->idx].offset;



More information about the dovecot-cvs mailing list