dovecot: Minor memory usage optimizations.

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 27 18:28:56 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/c2c8ee636157
changeset: 6319:c2c8ee636157
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 27 17:47:25 2007 +0300
description:
Minor memory usage optimizations.

diffstat:

1 file changed, 5 insertions(+), 5 deletions(-)
src/lib-index/mail-cache-compress.c |   10 +++++-----

diffs (57 lines):

diff -r 5313cbcfccc6 -r c2c8ee636157 src/lib-index/mail-cache-compress.c
--- a/src/lib-index/mail-cache-compress.c	Mon Aug 27 17:19:49 2007 +0300
+++ b/src/lib-index/mail-cache-compress.c	Mon Aug 27 17:47:25 2007 +0300
@@ -212,7 +212,7 @@ mail_cache_copy(struct mail_cache *cache
 			used_fields_count++;
 	}
 
-	t_array_init(ext_offsets, message_count);
+	i_array_init(ext_offsets, message_count);
 	for (seq = 1; seq <= message_count; seq++) {
 		if (mail_index_transaction_is_expunged(trans, seq)) {
 			(void)array_append_space(ext_offsets);
@@ -268,6 +268,7 @@ mail_cache_copy(struct mail_cache *cache
 		errno = output->stream_errno;
 		mail_cache_set_syscall_error(cache, "o_stream_flush()");
 		o_stream_destroy(&output);
+		array_free(ext_offsets);
 		return -1;
 	}
 
@@ -281,6 +282,7 @@ mail_cache_copy(struct mail_cache *cache
 	if (!cache->index->fsync_disable) {
 		if (fdatasync(fd) < 0) {
 			mail_cache_set_syscall_error(cache, "fdatasync()");
+			array_free(ext_offsets);
 			return -1;
 		}
 	}
@@ -376,10 +378,8 @@ static int mail_cache_compress_locked(st
 		return -1;
 	}
 
-	t_push();
 	if (mail_cache_copy(cache, trans, fd, &file_seq, &ext_offsets) < 0) {
 		(void)file_dotlock_delete(&dotlock);
-		t_pop();
 		return -1;
 	}
 
@@ -388,7 +388,7 @@ static int mail_cache_compress_locked(st
 		mail_cache_set_syscall_error(cache,
 					     "file_dotlock_replace()");
 		(void)close(fd);
-		t_pop();
+		array_free(&ext_offsets);
 		return -1;
 	}
 
@@ -402,7 +402,7 @@ static int mail_cache_compress_locked(st
 					      &offsets[i], &old_offset);
 		}
 	}
-	t_pop();
+	array_free(&ext_offsets);
 
 	if (*unlock) {
 		(void)mail_cache_unlock(cache);


More information about the dovecot-cvs mailing list