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 --- intl/dcigettext.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'intl') diff --git a/intl/dcigettext.c b/intl/dcigettext.c index d0c62eec7a..64de9d511a 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -1420,11 +1420,7 @@ plural_lookup (struct loaded_l10nfile *domain, unsigned long int n, p = translation; while (index-- > 0) { -#ifdef _LIBC - p = __rawmemchr (p, '\0'); -#else p = strchr (p, '\0'); -#endif /* And skip over the NUL byte. */ p++; -- cgit v1.2.3