Re: mutt_buffer_concat_path is broken [PATCH: 1/1] Version 2
Ian Collier via Mutt-dev <[email protected]> Fri, 8 May 2026 18:50:16 +0100
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, May 08, 2026 at 12:25:12PM -0400, Derek Martin wrote: > This is on Ubuntu LTS 24.04. Availability != ubiquity. I expect gcc > 15 won't be in widespread use for years yet. $ rpm -q gcc gcc-16.1.1-1.fc44.x86_64 That having been said, it's easily demonstrable that this gcc does not convert strspn(s,"x") [where "x" is a single-character literal] into a loop: it emits a call to strspn with a pointer to "x" in the data section, even with -O3. I certainly wouldn't expect it to optimize strspn(s,x) where x is a variable. As to which one is shorter and/or more readable (and noting that '/' is not the nul character): while (*ptr == '/') ptr++; ptr += strspn(str, "/"); clearly the second one is shorter, but the first one is more obvious in intent. However, manual pages exist for readers who don't know what strspn means. I think it's hard to argue that the first one is more likely to attract silly mistakes - there are few things more simple than that line of code in any significant program. Ian Collier.