From 32c7acd46401530fdbd4e98508c9baaa705f8b53 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Fri, 3 Feb 2023 12:01:33 +0000 Subject: 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 --- iconv/gconv_conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'iconv') diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c index 21165a558a..a75ac13e3f 100644 --- a/iconv/gconv_conf.c +++ b/iconv/gconv_conf.c @@ -502,8 +502,8 @@ __gconv_read_conf (void) do { const char *from = cp; - const char *to = __rawmemchr (from, '\0') + 1; - cp = __rawmemchr (to, '\0') + 1; + const char *to = strchr (from, '\0') + 1; + cp = strchr (to, '\0') + 1; add_alias2 (from, to, cp); } -- cgit 1.4.1