]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Merge mail_cache_reset() into mail_cache_unlink()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 2 Apr 2020 20:48:50 +0000 (23:48 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 09:41:43 +0000 (12:41 +0300)
There are no external callers to mail_cache_reset(), and this simplifies the
code.

src/lib-index/mail-cache.c
src/lib-index/mail-cache.h

index 77f581aaeee2eafea05b13a82396cd03bb5610a5..ebddcf28b3e59956a16d0a921a0a9ea5950ec879 100644 (file)
@@ -32,11 +32,6 @@ static void mail_cache_unlink(struct mail_cache *cache)
 {
        if (!cache->index->readonly && !MAIL_INDEX_IS_IN_MEMORY(cache->index))
                i_unlink_if_exists(cache->filepath);
-}
-
-void mail_cache_reset(struct mail_cache *cache)
-{
-       mail_cache_unlink(cache);
        /* mark the cache as unusable */
        cache->hdr = NULL;
 }
@@ -45,7 +40,7 @@ void mail_cache_set_corrupted(struct mail_cache *cache, const char *fmt, ...)
 {
        va_list va;
 
-       mail_cache_reset(cache);
+       mail_cache_unlink(cache);
 
        va_start(va, fmt);
        T_BEGIN {
@@ -316,7 +311,6 @@ mail_cache_map_finish(struct mail_cache *cache, uoff_t offset, size_t size,
                                !MAIL_CACHE_IS_UNUSABLE(cache) &&
                                cache->hdr->file_seq != 0 ?
                                cache->hdr->file_seq : 0;
-                       cache->hdr = NULL;
                        *corrupted_r = TRUE;
                        return -1;
                }
index e8cc64ec764631e9e42cf470f06bdfd52d900d7e..2bce3eb3a7cdfca35c0a1c295e50fae59b91845f 100644 (file)
@@ -155,8 +155,6 @@ void mail_cache_set_corrupted(struct mail_cache *cache, const char *fmt, ...)
        ATTR_FORMAT(2, 3);
 void mail_cache_set_seq_corrupted_reason(struct mail_cache_view *cache_view,
                                         uint32_t seq, const char *reason);
-/* Delete the cache file. */
-void mail_cache_reset(struct mail_cache *cache);
 
 /* Returns human-readable reason for why a cached field is missing for
    the specified mail. This is mainly for debugging purposes, so the exact