Re: [PATCH] memchr.3: Deprecate rawmemchr(3)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux