On Thu, Jul 16, 2020 at 7:53 AM Stefan Seyfried
<[email protected]> wrote:
>
> Am 09.07.20 um 21:13 schrieb Tito:
> > On 7/9/20 9:56 PM, Martin Lewis wrote:
> >> Please note that my original patch is still smaller:
> >> http://lists.busybox.net/pipermail/busybox/2020-June/088026.html
> >
> > Hi,
> > yes I know. This is smaller than what is in git now.
> > I understood that Denis rejected your patch:
> > "This scans the string twice, unnecessarily. Let's not do that."
>
> I'd really like an explanation, because for me this sentence looks
> wrong, I cannot see two scans, only one strrchr(). Or is strrchr so wrong?

strrchr(s,c) will first find the end of s, then go backwards looking for c.
The second part is wasted work, we only need to check the *last* char == c.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to