about summary refs log tree commit diff
path: root/nis/nis_call.c
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 /nis/nis_call.c
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 'nis/nis_call.c')
-rw-r--r--nis/nis_call.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/nis/nis_call.c b/nis/nis_call.c
index ec19b21c53..75f2129c76 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -483,7 +483,7 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, nis_error *status)
 	  }
 	while (nis_dir_cmp (domain, dir->do_name) != SAME_NAME);
 
-	cp = rawmemchr (leaf, '\0');
+	cp = strchr (leaf, '\0');
 	*cp++ = '.';
 	strcpy (cp, domain);
 
@@ -614,7 +614,7 @@ nis_server_cache_search (const_nis_name name, int search_parent,
 	if (ret == NULL)
 	  break;
 
-	addr = rawmemchr (nis_server_cache[i]->name, '\0') + 8;
+	addr = strchr (nis_server_cache[i]->name, '\0') + 8;
 	addr = (char *) ((uintptr_t) addr & ~(uintptr_t) 7);
 	xdrmem_create (&xdrs, addr, nis_server_cache[i]->size, XDR_DECODE);
 	if (!_xdr_directory_obj (&xdrs, ret))