[PATCH 4/* v2] Optimize strchrnul more

Joseph Myers joseph@codesourcery.com
Thu May 28 16:42:00 GMT 2015


On Sun, 24 May 2015, Ondřej Bílka wrote:

> +/* Return pointer to C in S.  */
> +#ifndef _HAVE_STRING_ARCH_strchr
> +# if __GNUC_PREREQ (3, 2)
> +#  define strchr(s, c) \
> +  (__extension__ ({ char *__r = strchrnul (s, c);			      \
> +		       *__r == c ? __r : NULL; }))
> +# endif
> +#endif

strchrnul is not an ISO C function.  If you want to define strchr in terms 
of it, you need to add an export of __strchrnul from libc.so (updating all 
the ABI test baselines), with an associated declaration in string.h, and 
then use it instead of strchrnul here.

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Libc-alpha mailing list