]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
lib/string.c: drop pointless __HAVE_ARCH_STRDUP
authorRasmus Villemoes <ravi@prevas.dk>
Tue, 21 Apr 2026 07:54:33 +0000 (09:54 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 12 May 2026 21:38:00 +0000 (15:38 -0600)
There has never been an arch-specific optimized implementation of
str[n]dup, nor is there likely to ever be one, because unlike their
cousins strlen(), strcpy() and similar that simply read/write the
src/dst, the dup functions by definition involve memory allocation. So
drop this irrelevant cpp guard.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
include/linux/string.h
lib/string.c

index 9e47fe01c165e5a52e6704eaec251ab6d0da2a2c..a28150fa5781d06243fadbc6c979fe7aa7123c19 100644 (file)
@@ -101,10 +101,9 @@ size_t strcspn(const char *s, const char *reject);
 # define strndup               sandbox_strndup
 #endif
 
-#ifndef __HAVE_ARCH_STRDUP
 extern char * strdup(const char *);
 extern char * strndup(const char *, size_t);
-#endif
+
 #ifndef __HAVE_ARCH_STRSWAB
 extern char * strswab(const char *);
 #endif
index c2813e0f8549ae05e489b2ef70fec50b90ac3b66..2c1baa568b97a7baac7efa49d0a4e66214dfc7c6 100644 (file)
@@ -343,7 +343,6 @@ size_t strcspn(const char *s, const char *reject)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRDUP
 char * strdup(const char *s)
 {
        char *new;
@@ -379,7 +378,6 @@ char * strndup(const char *s, size_t n)
 
        return new;
 }
-#endif
 
 #ifndef __HAVE_ARCH_STRSPN
 /**