On Thu, Apr 16, 2026 at 06:25:27AM +0200, Rene Kita wrote:
On Thu, Apr 16, 2026 at 09:16:52AM +0800, Kevin J. McCarthy wrote:I'd be interested if we could get a little further along to safety by adopting the same mechanism glibc recently did for strchr and the others. I haven't looked into what dark arts were involved.Do you have some pointer for me to where I can get more infos about those changes in glibc?
I haven't looked into this previously, but a little Googling turned up <https://en.wikipedia.org/wiki/C23_(C_standard_revision)> and specifically reference #57 next to "Make the functions bsearch(), bsearch_s(), memchr(), strchr(), strpbrk(), strrchr(), strstr(), and their wide counterparts wmemchr(), wcschr(), wcspbrk(), wcsrchr(), wcsstr() return a const qualified object if one was passed to them."
So... I guess this is C23. Which I know almost nothing about :-D. In any case, we're a long ways away from getting to that level of C standard support in Mutt.
So the only other alternative might be something like the other approach of a "const char *" function and a "char *" wrapper. I don't insist on that though; it was just brainstorming.
-- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
signature.asc
Description: PGP signature
