[PATCH] vi: fix regex search compilation error

Ron Yorston rmy at pobox.com
Tue Jul 13 20:42:05 UTC 2021


Bernhard Reutner-Fischer wrote:
>If i'm not mistaken, the s++ is fully redundant here although it seems
>that my gcc-11 does not optimize it like if we manually spell it out
>like in the attached?

I don't think it's possible to avoid two increments.  When a backslash
is detected we want to move past it and the following character.

Consider:

   strchr_backslash("\\/abc/def", '/');

The original code and Denys' rewrite return a pointer to "/def"; your
suggestion returns a pointer to "/abc/def".

>Must be marked noinline to avoid inlining it twice it seems?!
>If that double inlining really happens then the implied code growth
>even for -Os is a different bug..

Hmm, yes, that's rather an odd thing for the compiler to do.

Ron


More information about the busybox mailing list