[dovecot-cvs] dovecot: Combined mail_transaction_log_file_add_to_head() to

dovecot at dovecot.org dovecot at dovecot.org
Wed May 23 19:07:39 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/115d13bb1a47
changeset: 5658:115d13bb1a47
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 23 19:07:12 2007 +0300
description:
Combined mail_transaction_log_file_add_to_head() to
mail_transaction_log_file_add_to_list()

diffstat:

1 file changed, 5 insertions(+), 19 deletions(-)
src/lib-index/mail-transaction-log.c |   24 +++++-------------------

diffs (66 lines):

diff -r 42a62cd60308 -r 115d13bb1a47 src/lib-index/mail-transaction-log.c
--- a/src/lib-index/mail-transaction-log.c	Wed May 23 02:30:38 2007 +0300
+++ b/src/lib-index/mail-transaction-log.c	Wed May 23 19:07:12 2007 +0300
@@ -699,7 +699,7 @@ mail_transaction_log_file_create(struct 
 }
 
 static void
-mail_transaction_log_file_add_to_head(struct mail_transaction_log_file *file)
+mail_transaction_log_file_add_to_list(struct mail_transaction_log_file *file)
 {
 	struct mail_transaction_log *log = file->log;
 	struct mail_transaction_log_file **p;
@@ -715,25 +715,11 @@ mail_transaction_log_file_add_to_head(st
 		file->sync_offset = file->hdr.hdr_size;
 	}
 
-	/* append to end of list. */
-	for (p = &log->files; *p != NULL; p = &(*p)->next)
-		i_assert((*p)->hdr.file_seq < file->hdr.file_seq);
-	*p = file;
-}
-
-static void
-mail_transaction_log_file_add_to_list(struct mail_transaction_log_file *file)
-{
-	struct mail_transaction_log *log = file->log;
-	struct mail_transaction_log_file **p;
-
-	file->sync_offset = file->hdr.hdr_size;
-
 	/* insert it to correct position */
 	for (p = &log->files; *p != NULL; p = &(*p)->next) {
-		i_assert((*p)->hdr.file_seq != file->hdr.file_seq);
 		if ((*p)->hdr.file_seq > file->hdr.file_seq)
 			break;
+		i_assert((*p)->hdr.file_seq < file->hdr.file_seq);
 	}
 
 	file->next = *p;
@@ -791,7 +777,7 @@ mail_transaction_log_file_fd_open_or_cre
 	if (ret < 0)
 		return errno == ENOENT && try_retry ? 0 : -1;
 
-        mail_transaction_log_file_add_to_head(file);
+        mail_transaction_log_file_add_to_list(file);
 	return 1;
 }
 
@@ -813,7 +799,7 @@ mail_transaction_log_file_alloc_in_memor
 	file->buffer = buffer_create_dynamic(default_pool, 4096);
 	file->buffer_offset = sizeof(file->hdr);
 
-	mail_transaction_log_file_add_to_head(file);
+	mail_transaction_log_file_add_to_list(file);
 	return file;
 }
 
@@ -881,7 +867,7 @@ mail_transaction_log_file_open(struct ma
                 		TRUE, i < MAIL_INDEX_ESTALE_RETRY_COUNT);
 		if (ret > 0) {
 			/* success */
-			mail_transaction_log_file_add_to_head(file);
+			mail_transaction_log_file_add_to_list(file);
 			return file;
 		}
 


More information about the dovecot-cvs mailing list