On Thu, May 21, 2026 at 11:24:38AM +0200, Alejandro Colomar via Mutt-dev wrote:
On 2026-05-21T09:47:13+0800, Kevin J. McCarthy wrote:
+    else
+      lineInfo[n].search = safe_malloc(sizeof(struct syntax_t));

I not familiar with mutt(1)'s safe_realloc() and safe_malloc(), but
realloc(3) allows one to do the initial allocation too.

        p = realloc(NULL, n);  // equivalent to malloc(n);

From what I can see in mutt(1)'s safe_realloc(), it seems to also handle
that case (in fact, it even has a workaround for SunOS 4.1.x).

Do we really need this conditional?

I took a second look. lineInfo is memset to 0 on initial allocation and reallocs, so the search field is guaranteed to be NULL before the first allocation.

So no we don't need the branch. I'll add a second commit to the patchset to make that change, and will send that out tomorrow.

Thanks again.

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to