[dovecot-cvs] dovecot/src/lib-storage/index index-mail-headers.c, 1.48, 1.49

cras at dovecot.org cras at dovecot.org
Sun Jul 3 13:47:41 EEST 2005


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

Modified Files:
	index-mail-headers.c 
Log Message:
Don't store headers into cache file if they are already there.



Index: index-mail-headers.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail-headers.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- index-mail-headers.c	17 Apr 2005 15:43:45 -0000	1.48
+++ index-mail-headers.c	3 Jul 2005 10:47:38 -0000	1.49
@@ -66,7 +66,10 @@
 			   just want to ignore it. */
 			i_assert(match[match_idx] !=
 				 mail->header_match_value + 1);
-			if (match[match_idx] == mail->header_match_value) {
+			if (match[match_idx] == mail->header_match_value &&
+			    mail_cache_field_exists(mail->trans->cache_view,
+						    mail->data.seq,
+						    match_idx) == 0) {
 				/* this header doesn't exist. remember that. */
 				mail_cache_add(mail->trans->cache_trans,
 					       mail->data.seq, match_idx,
@@ -82,6 +85,11 @@
 			match_idx++;
 		}
 
+		if (!lines[i].cache) {
+			/* header is already cached */
+			continue;
+		}
+
 		/* buffer contains: { uint32_t line_num[], 0, header texts }
 		   noncontiguous is just a small optimization.. */
 		buffer_set_used_size(buf, 0);
@@ -118,7 +126,9 @@
 	}
 
 	for (; match_idx < match_count; match_idx++) {
-		if (match[match_idx] == mail->header_match_value) {
+		if (match[match_idx] == mail->header_match_value &&
+		    mail_cache_field_exists(mail->trans->cache_view,
+					    mail->data.seq, match_idx) == 0) {
 			/* this header doesn't exist. remember that. */
 			mail_cache_add(mail->trans->cache_trans,
 				       mail->data.seq, match_idx, NULL, 0);
@@ -151,7 +161,7 @@
 
         mail->header_match_value += 2;
 	if (mail->header_match_value == 0) {
-		/* @UNSAFE: wrapped, we'll have to clear the buffer */
+		/* wrapped, we'll have to clear the buffer */
 		array_clear(&mail->header_match);
 		mail->header_match_value = 2;
 	}



More information about the dovecot-cvs mailing list