/* if the decision isn't forced and this field hasn't
been accessed for a while, drop it */
if ((dec & MAIL_CACHE_DECISION_FORCED) == 0 &&
- priv->field.last_used < max_drop_time &&
- !priv->adding) {
+ priv->field.last_used < max_drop_time) {
dec = MAIL_CACHE_DECISION_NO;
priv->field.decision = dec;
}
/* drop all fields we don't want */
if ((dec & ~MAIL_CACHE_DECISION_FORCED) ==
- MAIL_CACHE_DECISION_NO && !priv->adding) {
+ MAIL_CACHE_DECISION_NO) {
priv->used = FALSE;
priv->field.last_used = 0;
}
return 0;
}
-static void mail_cache_mark_adding(struct mail_cache *cache, bool set)
+static void mail_cache_mark_used(struct mail_cache *cache)
{
unsigned int i;
/* we want to avoid adding all the fields one by one to the cache file,
so just add all of them at once in here. the unused ones get dropped
later when compressing. */
- for (i = 0; i < cache->fields_count; i++) {
- if (set)
- cache->fields[i].used = TRUE;
- cache->fields[i].adding = set;
- }
+ for (i = 0; i < cache->fields_count; i++)
+ cache->fields[i].used = TRUE;
}
static int
file_field = ctx->cache->field_file_map[field_idx];
if (MAIL_CACHE_IS_UNUSABLE(ctx->cache) || file_field == (uint32_t)-1) {
/* we'll have to add this field to headers */
- mail_cache_mark_adding(ctx->cache, TRUE);
+ mail_cache_mark_used(ctx->cache);
ret = mail_cache_header_add_field(ctx, field_idx);
- mail_cache_mark_adding(ctx->cache, FALSE);
if (ret < 0)
return -1;