Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8781:513ba5a698a1 HEAD
SORT: Don't waste data stack memory when sorting many messages.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 25 Feb 2009 14:26:25 -0500 |
parents | 037ff603e27a |
children | e5cc81734221 |
files | src/lib-storage/index/index-sort-string.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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;