Hi Alex, > It is not optimized, and it calls either strlen(3) or memchr(3), so the > caller can do it directly, and it will be better. > > Suggested-by: Wilco Dijkstra <Wilco.Dijkstra@xxxxxxx> > Signed-off-by: Alejandro Colomar <alx@xxxxxxxxxx> This looks good to me. Btw in the codesearch there are about 800 uses, the majority looks like prototypes etc, so there are few actual uses. Interestingly GLIBC still contains this: #ifdef _LIBC p = __rawmemchr (p, '\0'); #else p = strchr (p, '\0'); #endif The strchr (p, 0) is optimized by compilers into strlen (since that's obviously the right optimization) so adding rawmemchr was not only wasted effort, but it made things slower as well. So we should remove these uses from GLIBC. Cheers, Wilco