dovecot-1.2: SORT: Don't waste data stack memory when sorting ma...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Feb 25 21:26:31 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/513ba5a698a1
changeset: 8781:513ba5a698a1
user: Timo Sirainen <tss at iki.fi>
date: Wed Feb 25 14:26:25 2009 -0500
description:
SORT: Don't waste data stack memory when sorting many messages.
diffstat:
1 file changed, 10 insertions(+), 5 deletions(-)
src/lib-storage/index/index-sort-string.c | 15 ++++++++++-----
diffs (29 lines):
diff -r 037ff603e27a -r 513ba5a698a1 src/lib-storage/index/index-sort-string.c
--- a/src/lib-storage/index/index-sort-string.c Wed Feb 25 14:25:50 2009 -0500
+++ b/src/lib-storage/index/index-sort-string.c Wed Feb 25 14:26:25 2009 -0500
@@ -271,15 +271,20 @@ static void index_sort_zeroes(struct sor
ctx->sort_strings = i_new(const char *, ctx->last_seq + 1);
ctx->sort_string_pool = pool =
pool_alloconly_create("sort strings", 1024*64);
- str = t_str_new(512);
+ str = str_new(default_pool, 512);
nodes = array_get_modifiable(&ctx->zero_nodes, &count);
for (i = 0; i < count; i++) {
i_assert(nodes[i].seq <= ctx->last_seq);
- index_sort_header_get(mail, nodes[i].seq, sort_type, str);
- ctx->sort_strings[nodes[i].seq] = str_len(str) == 0 ? "" :
- p_strdup(pool, str_c(str));
- }
+ T_BEGIN {
+ index_sort_header_get(mail, nodes[i].seq,
+ sort_type, str);
+ ctx->sort_strings[nodes[i].seq] =
+ str_len(str) == 0 ? "" :
+ p_strdup(pool, str_c(str));
+ } T_END;
+ }
+ str_free(&str);
/* we have all strings, sort nodes based on them */
static_zero_cmp_context = ctx;
More information about the dovecot-cvs
mailing list