about summary refs log tree commit diff
path: root/manual/string.texi
diff options
context:
space:
mode:
authorWilco Dijkstra <wilco.dijkstra@arm.com>2023-02-03 12:01:33 +0000
committerWilco Dijkstra <wilco.dijkstra@arm.com>2023-02-06 16:16:19 +0000
commit32c7acd46401530fdbd4e98508c9baaa705f8b53 (patch)
tree000fcd17f9b6ddbc14af397f33963e72a3c9d4bb /manual/string.texi
parentd2d3f3720ce627a4fe154d8dd14db716a32bcc6e (diff)
downloadglibc-32c7acd46401530fdbd4e98508c9baaa705f8b53.tar.gz
glibc-32c7acd46401530fdbd4e98508c9baaa705f8b53.tar.xz
glibc-32c7acd46401530fdbd4e98508c9baaa705f8b53.zip
Replace rawmemchr (s, '\0') with strchr
Almost all uses of rawmemchr find the end of a string.  Since most targets use
a generic implementation, replacing it with strchr is better since that is
optimized by compilers into strlen (s) + s.  Also fix the generic rawmemchr
implementation to use a cast to unsigned char in the if statement.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'manual/string.texi')
-rw-r--r--manual/string.texi10
1 files changed, 1 insertions, 9 deletions
diff --git a/manual/string.texi b/manual/string.texi
index 7578aa1c26..e06433187e 100644
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -1726,15 +1726,7 @@ made an error in assuming that the byte @var{c} is present in the block.
 In this case the result is unspecified.  Otherwise the return value is a
 pointer to the located byte.
 
-This function is of special interest when looking for the end of a
-string.  Since all strings are terminated by a null byte a call like
-
-@smallexample
-   rawmemchr (str, '\0')
-@end smallexample
-
-@noindent
-will never go beyond the end of the string.
+When looking for the end of a string, use @code{strchr}.
 
 This function is a GNU extension.
 @end deftypefun