Re: [PATCH] Fix pager search behavior with REG_NEWLINE.
"Kevin J. McCarthy" <[email protected]> Thu, 21 May 2026 20:34:50 +0800
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <ag776gr-ow40RCf0@qinghai> |
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
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEiXWpszqjeRA4XFMIre92hIAxa9oFAmoO++oACgkQre92hIAx a9q8mRAArmKMNK64gf/Pq6wWVmR1c4OHkn0f9TyBda+Smimf7+jvUDkJ9HjwWU3c xSaS0HxBHkOihvJzJMAOq+F3VChsdDUbAMtn4W8NeK+6o9b4XMqvIav/0MAz/30O ynVYiJ/Rz3Cs7X6sgQhbFNP4dphpI/Io0wBh3IsPwrqImI6RETpNwPvrWNh1gMYa OlxvYIptSR9AIEyQGn85SaXDMot5kWGgubTCnZNejxmjuaAK/ChbKzPgiJA8n/+T W3t+vyoxKj6cF99YU6Ygs0crOLcfMr/0fOdeCGEw2iTOqoUM/cn0h+ZCDCbJEPuC CBfdVX4nru+C0UAS+/EAl4ek0NOHEN7Jc6jS8nHt3jRXURomh1rf/seGNG1vj22+ rzBt+mMDPtCjLlvSH2weS+b9ojUI4OoD4G4m/Wdu6CapTjJf1U4eTeoRwqDrlSKN vBQjpktaSQGJjQwEhus82J0B3KVqjmYLMJFMB4ZZDgOAujGtPh6vnUq9KJE6OSMi yJnPG9aLxnHYpvfkcJd15T9cEHzv7Fhb5/t9b9o82EaUNhBjslTSiJqHsKbI4hqL EdLYPdtLILlyJx9Z76tpdx9vBKFM1O0E1uLi1vCvzIoZSXw+WAEJGIokfhHVIPpj Z4o0BWoAzjxAOqcxsruchmy8+qce7wa/g/t7UYLY3JVyDgNnMzE= =c94m -----END PGP SIGNATURE-----