changeset: 7063:a636bc4a4940
user:      Kevin McCarthy <ke...@8t8.us>
date:      Wed May 24 15:46:41 2017 -0700
link:      http://dev.mutt.org/hg/mutt/rev/a636bc4a4940

Change imap body cache cleanup to use the uid_hash.

This should speed up $message_cache_clean cleanup when syncing.

diffs (31 lines):

diff -r 8904261ed212 -r a636bc4a4940 imap/message.c
--- a/imap/message.c    Tue May 23 15:54:46 2017 -0700
+++ b/imap/message.c    Wed May 24 15:46:41 2017 -0700
@@ -1128,24 +1128,17 @@
 
 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;
 }
 

Reply via email to