changeset 14884:7aece00b8538

lib-index: Support clearing the whole log view with mail_transaction_log_view_clear(0)
author Timo Sirainen <tss@iki.fi>
date Mon, 13 Aug 2012 00:33:47 +0300
parents 222c7d752519
children acc60089da4f
files src/lib-index/mail-transaction-log-view.c src/lib-index/mail-transaction-log.h
diffstat 2 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-view.c	Mon Aug 13 00:31:40 2012 +0300
+++ b/src/lib-index/mail-transaction-log-view.c	Mon Aug 13 00:33:47 2012 +0300
@@ -330,7 +330,8 @@
 	struct mail_transaction_log_file *file;
 
 	mail_transaction_log_view_unref_all(view);
-	if (mail_transaction_log_find_file(view->log, oldest_file_seq, FALSE,
+	if (oldest_file_seq != 0 &&
+	    mail_transaction_log_find_file(view->log, oldest_file_seq, FALSE,
 					   &file) > 0) {
 		for (; file != NULL; file = file->next) {
 			array_append(&view->file_refs, &file, 1);
--- a/src/lib-index/mail-transaction-log.h	Mon Aug 13 00:31:40 2012 +0300
+++ b/src/lib-index/mail-transaction-log.h	Mon Aug 13 00:33:47 2012 +0300
@@ -225,8 +225,8 @@
 /* Scan through all of the log files that we can find.
    Returns -1 if error, 0 if ok. */
 int mail_transaction_log_view_set_all(struct mail_transaction_log_view *view);
-/* Clear the view. Keep oldest_file_seq and newer log files referenced so we
-   don't get desynced. */
+/* Clear the view. If oldest_file_seq > 0, keep it and newer log files
+   referenced so we don't get desynced. */
 void mail_transaction_log_view_clear(struct mail_transaction_log_view *view,
 				     uint32_t oldest_file_seq);