changeset 12317:8a6cdefd829a

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.
author Timo Sirainen <tss@iki.fi>
date Wed, 20 Oct 2010 16:03:13 +0100
parents f170b3e39a34
children 8ccf177754b3
files src/lib-storage/index/index-status.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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)