dovecot-2.0: lib-storage: mailbox_get_status(): return cache fie...

dovecot at dovecot.org dovecot at dovecot.org
Wed Oct 20 18:07:11 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/8a6cdefd829a
changeset: 12317:8a6cdefd829a
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 20 16:03:13 2010 +0100
description:
lib-storage: mailbox_get_status(): return cache fields allocated from data stack.
Allocating them from mailbox's pool just wastes memory if it's called multiple
times for same mailbox.

diffstat:

 src/lib-storage/index/index-status.c |  6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diffs (16 lines):

diff -r f170b3e39a34 -r 8a6cdefd829a src/lib-storage/index/index-status.c
--- a/src/lib-storage/index/index-status.c	Wed Oct 20 16:01:46 2010 +0100
+++ b/src/lib-storage/index/index-status.c	Wed Oct 20 16:03:13 2010 +0100
@@ -19,10 +19,8 @@
 	fields = mail_cache_register_get_list(box->cache,
 					      pool_datastack_create(), &count);
 
-	/* a bit leaky to allocate memory from mailbox pool every time, but this
-	   is unlikely to be called more than once for the mailbox anyway. */
-	cache_fields = p_new(box->pool, ARRAY_TYPE(const_string), 1);
-	p_array_init(cache_fields, box->pool, count);
+	cache_fields = t_new(ARRAY_TYPE(const_string), 1);
+	t_array_init(cache_fields, count);
 	for (i = 0; i < count; i++) {
 		dec = fields[i].decision & ~MAIL_CACHE_DECISION_FORCED;
 		if (dec != MAIL_CACHE_DECISION_NO)


More information about the dovecot-cvs mailing list