On 25 Oct 2021, at 12:30, Ruediger Pluem <rpl...@apache.org> wrote:

>> begin is unused.

Will fix.

>> +
>> +        while ((hay = memchr(hay, *(char *)needle, len))) {
> 
> Does memchr have a defined behaviour for len == 0? This can happen if
> *(char *)needle is found at hay[len -1 ] but the memcmp below is not zero.
> In this case len becomes 1 below and 0 after the --len.

Code is a simplified version of this:

https://github.com/apache/apreq/blob/trunk/library/util.c#L92

I understand this to be the case.

The BSD man page on MacOS says “Zero-length strings are always identical” and 
the function is C90.

Regards,
Graham
—

Reply via email to