From: Kevin McCarthy Date: Wed, 24 May 2017 22:46:41 +0000 (-0700) Subject: Change imap body cache cleanup to use the uid_hash. X-Git-Tag: neomutt-20170707^2^2~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd9989eb3d5976692aaa11d36e104549cfd0d9c8;p=neomutt Change imap body cache cleanup to use the uid_hash. This should speed up $message_cache_clean cleanup when syncing. --- diff --git a/imap/message.c b/imap/message.c index ef3a66179..4ec1c01ed 100644 --- a/imap/message.c +++ b/imap/message.c @@ -1128,24 +1128,17 @@ int imap_cache_del (IMAP_DATA* idata, HEADER* h) static int msg_cache_clean_cb (const char* id, body_cache_t* bcache, void* data) { - unsigned int uv, uid, n; + unsigned int uv, uid; IMAP_DATA* idata = (IMAP_DATA*)data; if (sscanf (id, "%u-%u", &uv, &uid) != 2) return 0; /* bad UID */ - if (uv != idata->uid_validity) + if (uv != idata->uid_validity || + !int_hash_find (idata->uid_hash, uid)) mutt_bcache_del (bcache, id); - /* TODO: presort UIDs, walk in order */ - for (n = 0; n < idata->ctx->msgcount; n++) - { - if (uid == HEADER_DATA(idata->ctx->hdrs[n])->uid) - return 0; - } - mutt_bcache_del (bcache, id); - return 0; }