From eec013bbf66fd17fc5671de6744913cb68036a00 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Thu, 21 Oct 2021 13:40:32 +0200 Subject: 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 Link: https://lore.kernel.org/lkml/CAHk-=whoe211F8ND-9hZvfnib0UA4gga8DZJ+YaBZNbE4fubdg@mail.gmail.com/ Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik --- arch/s390/lib/string.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'arch/s390/lib/string.c') diff --git a/arch/s390/lib/string.c b/arch/s390/lib/string.c index a95ca6df4e5e..4c2d1a8949cc 100644 --- a/arch/s390/lib/string.c +++ b/arch/s390/lib/string.c @@ -251,25 +251,6 @@ int strcmp(const char *s1, const char *s2) EXPORT_SYMBOL(strcmp); #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, const char *s2, unsigned long l2) { -- cgit From f492bac3b6c8f95c1b543bced9dc3818f342b6f0 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Thu, 21 Oct 2021 14:43:10 +0200 Subject: s390/string: use generic strlcpy The generic version of strlcpy is identical to the architecure specific variant. Therefore use the generic variant. Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik --- arch/s390/include/asm/string.h | 2 -- arch/s390/lib/string.c | 26 -------------------------- 2 files changed, 28 deletions(-) (limited to 'arch/s390/lib/string.c') diff --git a/arch/s390/include/asm/string.h b/arch/s390/include/asm/string.h index 4f418850bfd6..3fae93ddb322 100644 --- a/arch/s390/include/asm/string.h +++ b/arch/s390/include/asm/string.h @@ -31,7 +31,6 @@ void *memmove(void *dest, const void *src, size_t n); #define __HAVE_ARCH_STRCMP /* arch function */ #define __HAVE_ARCH_STRCPY /* inline & arch function */ #define __HAVE_ARCH_STRLCAT /* arch function */ -#define __HAVE_ARCH_STRLCPY /* arch function */ #define __HAVE_ARCH_STRLEN /* inline & arch function */ #define __HAVE_ARCH_STRNCAT /* arch function */ #define __HAVE_ARCH_STRNCPY /* arch function */ @@ -42,7 +41,6 @@ void *memmove(void *dest, const void *src, size_t n); int memcmp(const void *s1, const void *s2, size_t n); int strcmp(const char *s1, const char *s2); size_t strlcat(char *dest, const char *src, size_t n); -size_t strlcpy(char *dest, const char *src, size_t size); char *strncat(char *dest, const char *src, size_t n); char *strncpy(char *dest, const char *src, size_t n); char *strstr(const char *s1, const char *s2); diff --git a/arch/s390/lib/string.c b/arch/s390/lib/string.c index 4c2d1a8949cc..d1955eabda28 100644 --- a/arch/s390/lib/string.c +++ b/arch/s390/lib/string.c @@ -97,32 +97,6 @@ char *strcpy(char *dest, const char *src) EXPORT_SYMBOL(strcpy); #endif -/** - * strlcpy - Copy a %NUL terminated string into a sized buffer - * @dest: Where to copy the string to - * @src: Where to copy the string from - * @size: size of destination buffer - * - * Compatible with *BSD: the result is always a valid - * NUL-terminated string that fits in the buffer (unless, - * of course, the buffer size is zero). It does not pad - * out the result like strncpy() does. - */ -#ifdef __HAVE_ARCH_STRLCPY -size_t strlcpy(char *dest, const char *src, size_t size) -{ - size_t ret = __strend(src) - src; - - if (size) { - size_t len = (ret >= size) ? size-1 : ret; - dest[len] = '\0'; - memcpy(dest, src, len); - } - return ret; -} -EXPORT_SYMBOL(strlcpy); -#endif - /** * strncpy - Copy a length-limited, %NUL-terminated string * @dest: Where to copy the string to -- cgit