cache->last_field_header_offset = offset;
if (next_count > cache->index->optimization_set.cache.purge_header_continue_count) {
- mail_cache_purge_later(cache, t_strdup_printf(
- "Too many continued headers (%u)", next_count));
+ mail_cache_purge_later(cache,
+ "Too many continued headers (%u)", next_count);
}
if (field_hdr_r != NULL) {
case MAIL_CACHE_PURGE_DROP_DECISION_NONE:
break;
case MAIL_CACHE_PURGE_DROP_DECISION_DROP:
- mail_cache_purge_later(cache, t_strdup_printf(
+ mail_cache_purge_later(cache,
"Drop old field %s (last_used=%"PRIdTIME_T")",
cache->fields[fidx].field.name,
- cache->fields[fidx].field.last_used));
+ cache->fields[fidx].field.last_used);
break;
case MAIL_CACHE_PURGE_DROP_DECISION_TO_TEMP:
/* This cache decision change can cause the field to be
dropped for old mails, so do it via purging. */
- mail_cache_purge_later(cache, t_strdup_printf(
+ mail_cache_purge_later(cache,
"Change cache decision to temp for old field %s "
"(last_used=%"PRIdTIME_T")",
cache->fields[fidx].field.name,
- cache->fields[fidx].field.last_used));
+ cache->fields[fidx].field.last_used);
break;
}
return TRUE;
}
-void mail_cache_purge_later(struct mail_cache *cache, const char *reason)
+void mail_cache_purge_later(struct mail_cache *cache,
+ const char *reason_format, ...)
{
+ va_list args;
+
i_assert(cache->hdr != NULL);
+ va_start(args, reason_format);
cache->need_purge_file_seq = cache->hdr->file_seq;
i_free(cache->need_purge_reason);
- cache->need_purge_reason = i_strdup(reason);
+ cache->need_purge_reason = i_strdup_vprintf(reason_format, args);
+
+ va_end(args);
}
void mail_cache_purge_later_reset(struct mail_cache *cache)
/* Returns TRUE if cache should be purged. */
bool mail_cache_need_purge(struct mail_cache *cache, const char **reason_r);
/* Set cache file to be purged later. */
-void mail_cache_purge_later(struct mail_cache *cache, const char *reason);
+void mail_cache_purge_later(struct mail_cache *cache,
+ const char *reason_format, ...) ATTR_FORMAT(2, 3);
/* Don't try to purge the cache file later after all. */
void mail_cache_purge_later_reset(struct mail_cache *cache);
/* Purge cache file. Offsets are updated to given transaction.