From: Timo Sirainen Date: Tue, 12 May 2020 08:20:57 +0000 (+0300) Subject: lib-index: Make mail_cache_decision_to_string() public X-Git-Tag: 2.3.11.2~98 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cfaf3e406f6f43a47215fd3e3772515f82bd3faf;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Make mail_cache_decision_to_string() public --- diff --git a/src/lib-index/mail-cache-decisions.c b/src/lib-index/mail-cache-decisions.c index 5e8d3103dc..28d571356a 100644 --- a/src/lib-index/mail-cache-decisions.c +++ b/src/lib-index/mail-cache-decisions.c @@ -70,6 +70,19 @@ #include "ioloop.h" #include "mail-cache-private.h" +const char *mail_cache_decision_to_string(enum mail_cache_decision_type dec) +{ + switch (dec & ~MAIL_CACHE_DECISION_FORCED) { + case MAIL_CACHE_DECISION_NO: + return "no"; + case MAIL_CACHE_DECISION_TEMP: + return "temp"; + case MAIL_CACHE_DECISION_YES: + return "yes"; + } + i_unreached(); +} + struct event_passthrough * mail_cache_decision_changed_event(struct mail_cache *cache, struct event *event, unsigned int field) diff --git a/src/lib-index/mail-cache-private.h b/src/lib-index/mail-cache-private.h index e5cf62af30..54d3fb8bfe 100644 --- a/src/lib-index/mail-cache-private.h +++ b/src/lib-index/mail-cache-private.h @@ -271,6 +271,7 @@ int mail_cache_sync_reset_id(struct mail_cache *cache); in the cache file. */ void mail_cache_decision_state_update(struct mail_cache_view *view, uint32_t seq, unsigned int field); +const char *mail_cache_decision_to_string(enum mail_cache_decision_type dec); struct event_passthrough * mail_cache_decision_changed_event(struct mail_cache *cache, struct event *event, unsigned int field); diff --git a/src/lib-index/mail-cache-purge.c b/src/lib-index/mail-cache-purge.c index 69cafefe80..b141c4e8bf 100644 --- a/src/lib-index/mail-cache-purge.c +++ b/src/lib-index/mail-cache-purge.c @@ -26,19 +26,6 @@ struct mail_cache_copy_context { bool new_msg; }; -static const char *cache_decision_str(enum mail_cache_decision_type dec) -{ - switch (dec & ~MAIL_CACHE_DECISION_FORCED) { - case MAIL_CACHE_DECISION_NO: - return "no"; - case MAIL_CACHE_DECISION_TEMP: - return "temp"; - case MAIL_CACHE_DECISION_YES: - return "yes"; - } - i_unreached(); -} - static void mail_cache_merge_bitmask(struct mail_cache_copy_context *ctx, const struct mail_cache_iterate_field *field) @@ -176,7 +163,7 @@ mail_cache_purge_check_field(struct mail_cache_copy_context *ctx, priv->field.last_used < ctx->max_temp_drop_time) { /* YES or TEMP decision field hasn't been accessed for a long time now. Drop it. */ - const char *dec_str = cache_decision_str(dec); + const char *dec_str = mail_cache_decision_to_string(dec); struct event_passthrough *e = event_create_passthrough(ctx->event)-> set_name("mail_cache_purge_drop_field")->