[dovecot-cvs] dovecot/src/lib-storage/index index-mail.c,1.5,1.6

cras at procontrol.fi cras at procontrol.fi
Wed Mar 26 17:40:18 EET 2003


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

Modified Files:
	index-mail.c 
Log Message:
memory usage fixes



Index: index-mail.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- index-mail.c	26 Mar 2003 14:52:20 -0000	1.5
+++ index-mail.c	26 Mar 2003 15:40:16 -0000	1.6
@@ -209,11 +209,9 @@
 			/* finalize the envelope */
 			string_t *str;
 
-			t_push();
 			str = str_new(mail->pool, 256);
 			imap_envelope_write_part_data(data->envelope_data, str);
 			data->envelope = str_c(str);
-			t_pop();
 		}
 	}
 
@@ -687,7 +685,9 @@
 int index_mail_next(struct index_mail *mail, struct mail_index_record *rec)
 {
 	struct index_mail_data *data = &mail->data;
-	int open_mail, parse_header;
+	int ret, open_mail, parse_header;
+
+	t_push();
 
 	/* close the old one */
 	if (data->stream != NULL)
@@ -773,22 +773,26 @@
 			open_mail(mail->ibox->index, data->rec,
 				  &data->received_date, &deleted);
 		if (data->stream == NULL)
-			return deleted ? 0 : -1;
-	}
-
-	if ((mail->wanted_fields & MAIL_FETCH_RECEIVED_DATE) &&
-	    data->received_date == (time_t)-1) {
-		/* check this only after open_mail() */
-		data->received_date = get_cached_received_date(mail);
-	}
+			ret = deleted ? 0 : -1;
+		else
+			ret = 1;
+	} else {
+		if ((mail->wanted_fields & MAIL_FETCH_RECEIVED_DATE) &&
+		    data->received_date == (time_t)-1) {
+			/* check this only after open_mail() */
+			data->received_date = get_cached_received_date(mail);
+		}
 
-	if (mail->wanted_fields & MAIL_FETCH_DATE)
-		data->save_sent_time = TRUE;
-	if (mail->wanted_fields & MAIL_FETCH_IMAP_ENVELOPE)
-		data->save_envelope = TRUE;
+		if (mail->wanted_fields & MAIL_FETCH_DATE)
+			data->save_sent_time = TRUE;
+		if (mail->wanted_fields & MAIL_FETCH_IMAP_ENVELOPE)
+			data->save_envelope = TRUE;
 
-	data->parse_header = parse_header;
-	return 1;
+		data->parse_header = parse_header;
+		ret = 1;
+	}
+	t_pop();
+	return ret;
 }
 
 void index_mail_deinit(struct index_mail *mail)




More information about the dovecot-cvs mailing list