From a31d9375dfbd7f0f4030c0b81f2030ff554529be Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 8 Jul 2026 22:37:05 +0200 Subject: string: remove unused strswab() function 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 Signed-off-by: Rasmus Villemoes --- lib/string.c | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 'lib/string.c') diff --git a/lib/string.c b/lib/string.c index 45f0f5f8d09..82d0b6a9caa 100644 --- a/lib/string.c +++ b/lib/string.c @@ -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 -- cgit v1.3.1