]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Change mail_index_view_get_transaction_count() into _have_transactions()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 20 Jan 2021 15:31:36 +0000 (17:31 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 3 May 2021 13:01:05 +0000 (13:01 +0000)
This allows removing mail_index_view.transactions in the next commit.

src/lib-index/mail-index-view.c
src/lib-index/mail-index.h
src/lib-storage/index/dbox-multi/mdbox-map.c

index 6b544a6def6a916804eca6c0a03b612eeee913ca..4d4e251afc6069423950a940ee208ea406eb7ae5 100644 (file)
@@ -99,12 +99,11 @@ struct mail_index *mail_index_view_get_index(struct mail_index_view *view)
        return view->index;
 }
 
-unsigned int
-mail_index_view_get_transaction_count(struct mail_index_view *view)
+bool mail_index_view_have_transactions(struct mail_index_view *view)
 {
        i_assert(view->transactions >= 0);
 
-       return view->transactions;
+       return view->transactions > 0;
 }
 
 void mail_index_view_transaction_ref(struct mail_index_view *view)
index b9ab3aaf7fdbe4da5cc0e5bed132f9ec554c5318..02e52a968b2322c387dc6572d6fb24f45be45e5d 100644 (file)
@@ -371,9 +371,8 @@ struct mail_index *mail_index_view_get_index(struct mail_index_view *view);
 uint32_t mail_index_view_get_messages_count(struct mail_index_view *view);
 /* Returns TRUE if we lost track of changes for some reason. */
 bool mail_index_view_is_inconsistent(struct mail_index_view *view);
-/* Returns number of transactions open for the view. */
-unsigned int
-mail_index_view_get_transaction_count(struct mail_index_view *view);
+/* Returns TRUE if there are open transactions open for the view. */
+bool mail_index_view_have_transactions(struct mail_index_view *view);
 
 /* Transaction has to be opened to be able to modify index. You can have
    multiple transactions open simultaneously. Committed transactions won't
index 3a6971c87a19b0445fefd4994108a2b23e570853..513db02c099760e04b49c40ff058ad27f3532598 100644 (file)
@@ -221,7 +221,7 @@ int mdbox_map_refresh(struct mdbox_map *map)
                mail_storage_set_index_error(MAP_STORAGE(map), map->index);
                return -1;
        }
-       if (mail_index_view_get_transaction_count(map->view) > 0) {
+       if (mail_index_view_have_transactions(map->view)) {
                /* can't sync when there are transactions */
                return 0;
        }