]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Use mail_cache_map_all() wherever possible
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 30 Mar 2020 14:18:42 +0000 (17:18 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 08:57:20 +0000 (08:57 +0000)
src/lib-index/mail-cache-compress.c
src/lib-index/mail-cache.c

index 1f06ef3191931b998d53600b3f5571f15cc85eb9..7f2071079c2cd3ea962fc53afba4759703c84e99 100644 (file)
@@ -435,7 +435,6 @@ static int mail_cache_compress_locked(struct mail_cache *cache, bool forced,
                                      bool *unlock, struct dotlock **dotlock_r)
 {
        const char *temp_path;
-       const void *data;
        int fd, ret;
 
        /* There are two possible locking situations here:
@@ -467,7 +466,7 @@ static int mail_cache_compress_locked(struct mail_cache *cache, bool forced,
        }
        if (cache->fd != -1) {
                /* make sure we have mapped it before reading. */
-               if (mail_cache_map(cache, 0, 0, &data) < 0)
+               if (mail_cache_map_all(cache) < 0)
                        return -1;
        }
 
@@ -483,7 +482,7 @@ static int mail_cache_compress_locked(struct mail_cache *cache, bool forced,
        if (cache->file_cache != NULL)
                file_cache_set_fd(cache->file_cache, cache->fd);
 
-       if (mail_cache_map(cache, 0, 0, &data) < 0)
+       if (mail_cache_map_all(cache) < 0)
                return -1;
        if (mail_cache_header_fields_read(cache) < 0)
                return -1;
index 81e2b7b5c4150c37e5baebf8a2a9c97b9c73e999..4c3e4f73c02cc06dbf176b1e39dfc3b18006751e 100644 (file)
@@ -123,8 +123,6 @@ static void mail_cache_init_file_cache(struct mail_cache *cache)
 
 static int mail_cache_try_open(struct mail_cache *cache)
 {
-       const void *data;
-
        i_assert(!cache->opened);
        cache->opened = TRUE;
 
@@ -147,7 +145,7 @@ static int mail_cache_try_open(struct mail_cache *cache)
 
        mail_cache_init_file_cache(cache);
 
-       if (mail_cache_map(cache, 0, 0, &data) < 0) {
+       if (mail_cache_map_all(cache) < 0) {
                mail_cache_file_close(cache);
                return -1;
        }
@@ -690,7 +688,6 @@ static int mail_cache_sync_reset_id(struct mail_cache *cache)
 static int
 mail_cache_lock_full(struct mail_cache *cache, bool nonblock)
 {
-       const void *data;
        int ret;
 
        i_assert(!cache->locked);
@@ -738,7 +735,7 @@ mail_cache_lock_full(struct mail_cache *cache, bool nonblock)
        }
        if (cache->read_buf != NULL)
                buffer_set_used_size(cache->read_buf, 0);
-       if (mail_cache_map(cache, 0, 0, &data) <= 0) {
+       if (mail_cache_map_all(cache) < 0) {
                (void)mail_cache_unlock(cache);
                return -1;
        }