Skip to content

Instantly share code, notes, and snippets.

@mfleming
Created January 15, 2017 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfleming/aa29c562bdb32fe938a4e35694f67092 to your computer and use it in GitHub Desktop.
Save mfleming/aa29c562bdb32fe938a4e35694f67092 to your computer and use it in GitHub Desktop.
mutt hash patch
diff -r 02bc14ed1569 mh.c
--- a/mh.c Tue Dec 08 09:12:09 2015 -0800
+++ b/mh.c Sun Jan 15 21:35:48 2017 +0000
@@ -1908,6 +1908,7 @@
struct maildir *md; /* list of messages in the mailbox */
struct maildir **last, *p;
int i;
+ int count = 0;
HASH *fnames; /* hash table for quickly looking up the base filename
for a maildir message */
struct mh_data *data = mh_data (ctx);
@@ -1945,15 +1946,15 @@
md = NULL;
last = &md;
if (changed & 1)
- maildir_parse_dir (ctx, &last, "new", NULL, NULL);
+ maildir_parse_dir (ctx, &last, "new", &count, NULL);
if (changed & 2)
- maildir_parse_dir (ctx, &last, "cur", NULL, NULL);
+ maildir_parse_dir (ctx, &last, "cur", &count, NULL);
/* we create a hash table keyed off the canonical (sans flags) filename
* of each message we scanned. This is used in the loop over the
* existing messages below to do some correlation.
*/
- fnames = hash_create (1031, 0);
+ fnames = hash_create (count, 0);
for (p = md; p; p = p->next)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment