dovecot-2.0: lib-storage: Use less memory from data stack.

dovecot at dovecot.org dovecot at dovecot.org
Tue Aug 4 21:35:31 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/51d280d34bfa
changeset: 9721:51d280d34bfa
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 03 16:01:04 2009 -0400
description:
lib-storage: Use less memory from data stack.

diffstat:

3 files changed, 15 insertions(+), 3 deletions(-)
src/lib-storage/index/index-mail.h           |    2 +-
src/lib-storage/index/maildir/maildir-mail.c |    9 ++++++++-
src/lib-storage/mail-storage.c               |    7 ++++++-

diffs (59 lines):

diff -r 5f2bcf817c94 -r 51d280d34bfa src/lib-storage/index/index-mail.h
--- a/src/lib-storage/index/index-mail.h	Mon Aug 03 15:23:14 2009 -0400
+++ b/src/lib-storage/index/index-mail.h	Mon Aug 03 16:01:04 2009 -0400
@@ -77,7 +77,7 @@ struct index_mail_data {
 	uint32_t parse_line_num;
 
 	struct message_part *parts;
-	const char *envelope, *body, *bodystructure, *uid_string;
+	const char *envelope, *body, *bodystructure, *uid_string, *guid;
 	struct message_part_envelope_data *envelope_data;
 
 	uint32_t seq;
diff -r 5f2bcf817c94 -r 51d280d34bfa src/lib-storage/index/maildir/maildir-mail.c
--- a/src/lib-storage/index/maildir/maildir-mail.c	Mon Aug 03 15:23:14 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-mail.c	Mon Aug 03 16:01:04 2009 -0400
@@ -424,6 +424,10 @@ maildir_mail_get_special(struct mail *_m
 	switch (field) {
 	case MAIL_FETCH_UIDL_FILE_NAME:
 	case MAIL_FETCH_GUID:
+		if (mail->data.guid != NULL) {
+			*value_r = mail->data.guid;
+			return 0;
+		}
 		if (_mail->uid != 0) {
 			if (maildir_mail_get_fname(mbox, _mail, &fname) <= 0)
 				return -1;
@@ -434,7 +438,10 @@ maildir_mail_get_special(struct mail *_m
 			fname = fname != NULL ? fname + 1 : path;
 		}
 		end = strchr(fname, MAILDIR_INFO_SEP);
-		*value_r = end == NULL ? fname : t_strdup_until(fname, end);
+		mail->data.guid = end == NULL ?
+			p_strdup(mail->data_pool, fname) :
+			p_strdup_until(mail->data_pool, fname, end);
+		*value_r = mail->data.guid;
 		return 0;
 	case MAIL_FETCH_UIDL_BACKEND:
 		uidl = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid,
diff -r 5f2bcf817c94 -r 51d280d34bfa src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Mon Aug 03 15:23:14 2009 -0400
+++ b/src/lib-storage/mail-storage.c	Mon Aug 03 16:01:04 2009 -0400
@@ -599,11 +599,16 @@ struct mailbox_sync_context *
 struct mailbox_sync_context *
 mailbox_sync_init(struct mailbox *box, enum mailbox_sync_flags flags)
 {
+	struct mailbox_sync_context *ctx;
+
 	if (box->transaction_count != 0) {
 		i_panic("Trying to sync mailbox %s with open transactions",
 			box->name);
 	}
-	return box->v.sync_init(box, flags);
+	T_BEGIN {
+		ctx = box->v.sync_init(box, flags);
+	} T_END;
+	return ctx;
 }
 
 bool mailbox_sync_next(struct mailbox_sync_context *ctx,


More information about the dovecot-cvs mailing list