[dovecot-cvs] dovecot/src/lib-index mail-index.c,1.92,1.93 mail-index.h,1.83,1.84

cras at procontrol.fi cras at procontrol.fi
Sat Jul 26 20:33:24 EEST 2003


Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv28560/lib-index

Modified Files:
	mail-index.c mail-index.h 
Log Message:
API change for expunging messages. Not exactly what I wanted, but good
enough.



Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- mail-index.c	21 Jul 2003 14:35:39 -0000	1.92
+++ mail-index.c	26 Jul 2003 16:33:22 -0000	1.93
@@ -657,29 +657,6 @@
 	}
 }
 
-#if 0
-static int mail_index_truncate_hole(struct mail_index *index)
-{
-	index->header->used_file_size = sizeof(struct mail_index_header) +
-		(uoff_t)index->header->first_hole_index *
-		sizeof(struct mail_index_record);
-	index->header->first_hole_index = 0;
-	index->header->first_hole_records = 0;
-
-	index->mmap_used_length = index->header->used_file_size;
-	if (!mail_index_truncate(index))
-		return FALSE;
-
-	if (index->header->messages_count == 0) {
-		/* all mail was deleted, truncate data file */
-		if (!mail_index_data_reset(index->data))
-			return FALSE;
-	}
-
-	return TRUE;
-}
-#endif
-
 #define INDEX_NEED_COMPRESS(records, hdr) \
 	((records) > INDEX_MIN_RECORDS_COUNT && \
 	 (records) * (100-INDEX_COMPRESS_PERCENTAGE) / 100 > \
@@ -697,6 +674,8 @@
 	i_assert(first_seq != 0);
 	i_assert(first_seq <= last_seq);
 
+	index->expunge_counter++;
+
 	first_uid = first_rec->uid;
 	last_uid = last_rec->uid;
 
@@ -708,6 +687,12 @@
 						 first_seq, last_seq,
 						 first_uid, last_uid,
 						 external_change))
+			return FALSE;
+	}
+
+	if (index->header->messages_count == 0) {
+		/* all mail was deleted, truncate data file */
+		if (!mail_index_data_reset(index->data))
 			return FALSE;
 	}
 

Index: mail-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- mail-index.h	21 Jul 2003 14:35:39 -0000	1.83
+++ mail-index.h	26 Jul 2003 16:33:22 -0000	1.84
@@ -385,6 +385,8 @@
 
         /* updated whenever exclusive lock is set/unset */
 	unsigned int excl_lock_counter;
+	/* updated whenever expunge() is called */
+	unsigned int expunge_counter;
 
 	int mbox_fd;
 	struct istream *mbox_stream;
@@ -454,11 +456,11 @@
    members.. */
 #define MAIL_INDEX_PRIVATE_FILL \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
-	0, 0, 0, 0, 0, { 0, 0, 0 }, 0, 0, \
+	0, 0, 0, 0, 0, 0, { 0, 0, 0 }, 0, \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
-	0, 0, 0, 0, 0, 0
+	0, 0, 0, 0, 0, 0, 0
 #endif
 
 /* defaults - same as above but prefixed with mail_index_. */



More information about the dovecot-cvs mailing list