about summary refs log tree commit diff
path: root/string/bits
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2017-02-10 17:26:16 +0000
committerWilco Dijkstra <wdijkstr@arm.com>2017-02-10 17:28:11 +0000
commit40b7fbf27310d4f4a899aa2c54740dce5369ec70 (patch)
treedf78f63943d48a7e7af1718d1db7b8229044a2f1 /string/bits
parent3403a17fea8ccef7dc5f99553a13231acf838744 (diff)
downloadglibc-40b7fbf27310d4f4a899aa2c54740dce5369ec70.tar.gz
glibc-40b7fbf27310d4f4a899aa2c54740dce5369ec70.tar.xz
glibc-40b7fbf27310d4f4a899aa2c54740dce5369ec70.zip
GLIBC uses strchr (s, '\0') as an idiom to find the end of a string.
This is transformed into rawmemchr by the bits/string2.h header.
However this is generally slower than strlen on most targets, even when
an optimized rawmemchr implementation exists.  Since GCC7 optimizes
strchr (s, '\0') to strlen (s) + s, the GLIBC headers should not
transform this to rawmemchr.  As GCC recognizes strchr as a builtin,
defining strchr as the builtin is not useful.

	* string/bits/string2.h (strchr): Remove define.
Diffstat (limited to 'string/bits')
-rw-r--r--string/bits/string2.h10
1 files changed, 0 insertions, 10 deletions
diff --git a/string/bits/string2.h b/string/bits/string2.h
index e5337becf6..8b138a2a3c 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -58,16 +58,6 @@
 #endif
 
 
-#ifndef _HAVE_STRING_ARCH_strchr
-extern void *__rawmemchr (const void *__s, int __c);
-#  define strchr(s, c) \
-  (__extension__ (__builtin_constant_p (c) && !__builtin_constant_p (s)	      \
-		  && (c) == '\0'					      \
-		  ? (char *) __rawmemchr (s, c)				      \
-		  : __builtin_strchr (s, c)))
-#endif
-
-
 /* Copy SRC to DEST, returning pointer to final NUL byte.  */
 #ifdef __USE_GNU
 # ifndef _HAVE_STRING_ARCH_stpcpy