This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 4/* v2] Optimize strchrnul more
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Ondřej Bílka <neleai at seznam dot cz>
- Cc: <libc-alpha at sourceware dot org>, Wilco Dijkstra <wdijkstr at arm dot com>
- Date: Thu, 28 May 2015 16:11:03 +0000
- Subject: Re: [PATCH 4/* v2] Optimize strchrnul more
- Authentication-results: sourceware.org; auth=none
- References: <20150524150715 dot GA31589 at domone> <20150524163214 dot GA28053 at domone> <20150524171036 dot GA20947 at domone>
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