]> granicus.if.org Git - neomutt/commitdiff
Improve imap uid seqset hcache buffer usage
authorKevin McCarthy <kevin@8t8.us>
Sun, 10 Mar 2019 02:03:52 +0000 (10:03 +0800)
committerRichard Russon <rich@flatcap.org>
Tue, 9 Apr 2019 11:54:27 +0000 (12:54 +0100)
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.

Co-authored-by: Richard Russon <rich@flatcap.org>
imap/util.c

index 6cc68a1bd94ef80161c491db7fdcbf5ee23f653b..54923b8ffdd746a23aec871e881ab7e330e5cf9d 100644 (file)
@@ -530,11 +530,8 @@ int imap_hcache_store_uid_seqset(struct ImapMboxData *mdata)
   mutt_buffer_increase_size(b, 8192);
   imap_msn_index_to_uid_seqset(b, mdata);
 
-  size_t seqset_size = b->dptr - b->data;
-  if (seqset_size == 0)
-    b->data[0] = '\0';
-
-  int rc = mutt_hcache_store_raw(mdata->hcache, "/UIDSEQSET", 10, b->data, seqset_size + 1);
+  int rc = mutt_hcache_store_raw(mdata->hcache, "/UIDSEQSET", 10, b->data,
+                                 mutt_buffer_len(b) + 1);
   mutt_debug(LL_DEBUG3, "Stored /UIDSEQSET %s\n", b->data);
   mutt_buffer_free(&b);
   return rc;