mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +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:
@@ -74,7 +74,6 @@
|
||||
# endif
|
||||
# define __mempcpy mempcpy
|
||||
# define __pathconf pathconf
|
||||
# define __rawmemchr rawmemchr
|
||||
# define __readlink readlink
|
||||
# define __stat stat
|
||||
#endif
|
||||
@@ -232,7 +231,7 @@ realpath_stk (const char *name, char *resolved, struct realpath_bufs *bufs)
|
||||
return NULL;
|
||||
rname = bufs->rname.data;
|
||||
}
|
||||
dest = __rawmemchr (rname, '\0');
|
||||
dest = strchr (rname, '\0');
|
||||
start = name;
|
||||
prefix_len = FILE_SYSTEM_PREFIX_LEN (rname);
|
||||
}
|
||||
|
Reference in New Issue
Block a user