@@ -108,18 +108,27 @@ __STRING2_COPY_TYPE (8);
#endif
-/* Return pointer to C in S. */
-#ifndef _HAVE_STRING_ARCH_strchr
+#ifndef _HAVE_STRING_ARCH_strchrnul
extern void *__rawmemchr (const void *__s, int __c);
# if __GNUC_PREREQ (3, 2)
-# define strchr(s, c) \
+# define strchrnul(s, c) \
(__extension__ (__builtin_constant_p (c) && !__builtin_constant_p (s) \
&& (c) == '\0' \
? (char *) __rawmemchr (s, c) \
- : __builtin_strchr (s, c)))
+ : __strchrnul (s, c)))
# endif
#endif
+/* 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
+
+
/* Copy SRC to DEST, returning pointer to final NUL byte. */
#ifdef __USE_GNU
# if !defined _HAVE_STRING_ARCH_stpcpy || defined _FORCE_INLINES