]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
string: remove unused strswab() function
authorRasmus Villemoes <rv@rasmusvillemoes.dk>
Wed, 8 Jul 2026 20:37:05 +0000 (22:37 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 21 Jul 2026 19:51:07 +0000 (13:51 -0600)
The last use of this function with rather peculiar semantics[*] vanished
in 2021 with 0a527fda782 ("Fix IDE commands issued, fix endian issues,
fix non MMIO"). It has no tests, and should a need for something
similar ever appear, it is better done with some proper
utf16le/utf16be/utf16 abstractions rather than cluttering code with
'#ifdef __LITTLE_ENDIAN'.

[*] The byte-swapping itself is weird enough. But why is an input string
of odd length ok, while the empty string is not allowed?

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

index 488a459ed99da3b73d93fc512e06ab27a0b78486..5bcbf72a89b43218652c3593d4b8a55741259169 100644 (file)
@@ -107,10 +107,6 @@ extern char * strndup(const char *, size_t);
 extern const char *strdup_const(const char *s);
 extern void kfree_const(const void *x);
 
-#ifndef __HAVE_ARCH_STRSWAB
-extern char * strswab(const char *);
-#endif
-
 #ifndef __HAVE_ARCH_MEMSET
 extern void * memset(void *,int,__kernel_size_t);
 #endif
index 45f0f5f8d09c2d3ebc0ea6f2c49e1061cd9c3377..82d0b6a9caa107a82ed3ff467746c2eac19d8b14 100644 (file)
@@ -503,34 +503,6 @@ char * strsep(char **s, const char *ct)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRSWAB
-/**
- * strswab - swap adjacent even and odd bytes in %NUL-terminated string
- * s: address of the string
- *
- * returns the address of the swapped string or NULL on error. If
- * string length is odd, last byte is untouched.
- */
-char *strswab(const char *s)
-{
-       char *p, *q;
-
-       if ((NULL == s) || ('\0' == *s)) {
-               return (NULL);
-       }
-
-       for (p=(char *)s, q=p+1; (*p != '\0') && (*q != '\0'); p+=2, q+=2) {
-               char  tmp;
-
-               tmp = *p;
-               *p  = *q;
-               *q  = tmp;
-       }
-
-       return (char *) s;
-}
-#endif
-
 #ifndef __HAVE_ARCH_MEMSET
 /**
  * memset - Fill a region of memory with the given value