changeset 1799:eaf7de575156 HEAD

Use data stack pool instead of temp_pool. Fixes sorting by subject.
author Timo Sirainen <tss@iki.fi>
date Fri, 03 Oct 2003 19:20:58 +0300
parents 69c2ec6d198b
children 9f25c3d7b378
files src/imap/imap-sort.c
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/imap-sort.c	Fri Oct 03 19:18:28 2003 +0300
+++ b/src/imap/imap-sort.c	Fri Oct 03 19:20:58 2003 +0300
@@ -40,7 +40,7 @@
 	buffer_t *sort_buffer;
 	size_t sort_element_size;
 
-	pool_t temp_pool, str_pool;
+	pool_t str_pool;
 	struct hash_table *string_table;
 
 	time_t last_arrival, last_date;
@@ -179,7 +179,6 @@
 	if (ctx->str_pool != NULL)
 		pool_unref(ctx->str_pool);
 	buffer_free(ctx->sort_buffer);
-	pool_unref(ctx->temp_pool);
 
 	i_free(ctx->last_cc);
 	i_free(ctx->last_from);
@@ -232,7 +231,6 @@
 
 	ctx->box = client->mailbox;
 	ctx->output = client->output;
-	ctx->temp_pool = pool_alloconly_create("sort temp", 8192);
 	ctx->sort_buffer = buffer_create_dynamic(system_pool,
 						 128 * ctx->sort_element_size,
 						 (size_t)-1);
@@ -349,9 +347,8 @@
 	if (ctx->common_mask & MAIL_SORT_SUBJECT) {
 		str = mail->get_header(mail, "subject");
 		if (str != NULL) {
-			p_clear(ctx->temp_pool);
-			str = imap_get_base_subject_cased(ctx->temp_pool,
-							  str, NULL);
+			str = imap_get_base_subject_cased(
+				pool_datastack_create(), str, NULL);
 		}
 
 		if (null_strcmp(str, ctx->last_subject) != 0) {
@@ -470,9 +467,8 @@
 			str = mail->get_header(mail, "subject");
 
 			if (str != NULL) {
-				p_clear(ctx->temp_pool);
 				str = imap_get_base_subject_cased(
-					ctx->temp_pool, str, NULL);
+					pool_datastack_create(), str, NULL);
 			}
 		}
 		str = string_table_get(ctx, str);
@@ -555,6 +551,7 @@
 {
 	const char *str;
 	enum mail_sort_type type2;
+	pool_t pool;
 	int pos;
 
 	if ((ctx->cache_mask & type) == 0) {
@@ -569,9 +566,8 @@
 			if (str == NULL)
 				return NULL;
 
-			p_clear(ctx->temp_pool);
-			return imap_get_base_subject_cased(ctx->temp_pool,
-							   str, NULL);
+			pool = pool_datastack_create();
+			return imap_get_base_subject_cased(pool, str, NULL);
 		case MAIL_SORT_CC:
 			str = get_first_mailbox(mail, "cc");
 			break;