s390/string: use generic strrchr

Use generic strrchr instead of an optimized architecture specific
variant. Performance of strrchr is not relevant for real life
workloads, since the only user which may call this more frequently
would be kbasename().

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/lkml/CAHk-=whoe211F8ND-9hZvfnib0UA4gga8DZJ+YaBZNbE4fubdg@mail.gmail.com/
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Heiko Carstens 2021-10-21 13:40:32 +02:00 коммит произвёл Vasily Gorbik
Родитель 132c1e74aa
Коммит eec013bbf6
2 изменённых файлов: 0 добавлений и 21 удалений

Просмотреть файл

@ -36,7 +36,6 @@ void *memmove(void *dest, const void *src, size_t n);
#define __HAVE_ARCH_STRNCAT /* arch function */ #define __HAVE_ARCH_STRNCAT /* arch function */
#define __HAVE_ARCH_STRNCPY /* arch function */ #define __HAVE_ARCH_STRNCPY /* arch function */
#define __HAVE_ARCH_STRNLEN /* inline & arch function */ #define __HAVE_ARCH_STRNLEN /* inline & arch function */
#define __HAVE_ARCH_STRRCHR /* arch function */
#define __HAVE_ARCH_STRSTR /* arch function */ #define __HAVE_ARCH_STRSTR /* arch function */
/* Prototypes for non-inlined arch strings functions. */ /* Prototypes for non-inlined arch strings functions. */
@ -46,7 +45,6 @@ size_t strlcat(char *dest, const char *src, size_t n);
size_t strlcpy(char *dest, const char *src, size_t size); size_t strlcpy(char *dest, const char *src, size_t size);
char *strncat(char *dest, const char *src, size_t n); char *strncat(char *dest, const char *src, size_t n);
char *strncpy(char *dest, const char *src, size_t n); char *strncpy(char *dest, const char *src, size_t n);
char *strrchr(const char *s, int c);
char *strstr(const char *s1, const char *s2); char *strstr(const char *s1, const char *s2);
#endif /* !CONFIG_KASAN */ #endif /* !CONFIG_KASAN */

Просмотреть файл

@ -251,25 +251,6 @@ int strcmp(const char *s1, const char *s2)
EXPORT_SYMBOL(strcmp); EXPORT_SYMBOL(strcmp);
#endif #endif
/**
* strrchr - Find the last occurrence of a character in a string
* @s: The string to be searched
* @c: The character to search for
*/
#ifdef __HAVE_ARCH_STRRCHR
char *strrchr(const char *s, int c)
{
ssize_t len = __strend(s) - s;
do {
if (s[len] == (char)c)
return (char *)s + len;
} while (--len >= 0);
return NULL;
}
EXPORT_SYMBOL(strrchr);
#endif
static inline int clcle(const char *s1, unsigned long l1, static inline int clcle(const char *s1, unsigned long l1,
const char *s2, unsigned long l2) const char *s2, unsigned long l2)
{ {