mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
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>
This commit is contained in:
@ -269,7 +269,7 @@ CONCAT(_nss_db_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer,
|
||||
+ state.header->valstrlen);
|
||||
while (entidx < end)
|
||||
{
|
||||
const char *next = rawmemchr (entidx, '\0') + 1;
|
||||
const char *next = strchr (entidx, '\0') + 1;
|
||||
size_t len = next - entidx;
|
||||
|
||||
if (len > buflen)
|
||||
|
Reference in New Issue
Block a user