]> granicus.if.org Git - mutt/commitdiff
Improve imap uid seqset hcache buffer usage.
authorKevin McCarthy <kevin@8t8.us>
Sun, 10 Mar 2019 02:03:52 +0000 (10:03 +0800)
committerKevin McCarthy <kevin@8t8.us>
Sun, 10 Mar 2019 02:03:52 +0000 (10:03 +0800)
mutt_buffer_increase_size() terminates the buffer, so there is no need
to explicitly check for an empty buffer after the
imap_msn_index_to_uid_seqset() call.

imap/util.c

index 3bae9be39ee5070c3f1ea335c6151d99defd3f3e..a1977216a17584fdad89722e686f27cffd15c577 100644 (file)
@@ -227,7 +227,6 @@ int imap_hcache_del (IMAP_DATA* idata, unsigned int uid)
 int imap_hcache_store_uid_seqset (IMAP_DATA *idata)
 {
   BUFFER *b;
-  size_t seqset_size;
   int rc;
 
   if (!idata->hcache)
@@ -238,12 +237,8 @@ int imap_hcache_store_uid_seqset (IMAP_DATA *idata)
   mutt_buffer_increase_size (b, HUGE_STRING);
   imap_msn_index_to_uid_seqset (b, idata);
 
-  seqset_size = b->dptr - b->data;
-  if (seqset_size == 0)
-    b->data[0] = '\0';
-
   rc = mutt_hcache_store_raw (idata->hcache, "/UIDSEQSET",
-                              b->data, seqset_size + 1,
+                              b->data, mutt_buffer_len (b) + 1,
                               imap_hcache_keylen);
   dprint (5, (debugfile, "Stored /UIDSEQSET %s\n", b->data));
   mutt_buffer_free (&b);