From: Kevin McCarthy Date: Sun, 10 Mar 2019 02:03:52 +0000 (+0800) Subject: Improve imap uid seqset hcache buffer usage X-Git-Tag: 2019-10-25~276^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d56a8bf7ed39e248bff24fd9cf68339567e5d33f;p=neomutt Improve imap uid seqset hcache buffer usage 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 --- diff --git a/imap/util.c b/imap/util.c index 6cc68a1bd..54923b8ff 100644 --- a/imap/util.c +++ b/imap/util.c @@ -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;