From: Timo Sirainen Date: Mon, 30 Mar 2020 14:18:42 +0000 (+0300) Subject: lib-index: Use mail_cache_map_all() wherever possible X-Git-Tag: 2.3.11.2~442 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5c424a80691129405006d4959b913bbeb65d0e9;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Use mail_cache_map_all() wherever possible --- diff --git a/src/lib-index/mail-cache-compress.c b/src/lib-index/mail-cache-compress.c index 1f06ef3191..7f2071079c 100644 --- a/src/lib-index/mail-cache-compress.c +++ b/src/lib-index/mail-cache-compress.c @@ -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; diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index 81e2b7b5c4..4c3e4f73c0 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -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; }