about summary refs log tree commit diff
path: root/inet
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 /inet
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 'inet')
-rw-r--r--inet/getnetgrent_r.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c
index 833fe21b91..60f476b661 100644
--- a/inet/getnetgrent_r.c
+++ b/inet/getnetgrent_r.c
@@ -217,11 +217,11 @@ nscd_getnetgrent (struct __netgrent *datap, char *buffer, size_t buflen,
 
   datap->type = triple_val;
   datap->val.triple.host = get_nonempty_val (datap->cursor);
-  datap->cursor = (char *) __rawmemchr (datap->cursor, '\0') + 1;
+  datap->cursor = strchr (datap->cursor, '\0') + 1;
   datap->val.triple.user = get_nonempty_val (datap->cursor);
-  datap->cursor = (char *) __rawmemchr (datap->cursor, '\0') + 1;
+  datap->cursor = strchr (datap->cursor, '\0') + 1;
   datap->val.triple.domain = get_nonempty_val (datap->cursor);
-  datap->cursor = (char *) __rawmemchr (datap->cursor, '\0') + 1;
+  datap->cursor = strchr (datap->cursor, '\0') + 1;
 
   return NSS_STATUS_SUCCESS;
 }