diff options
author | wdenk <wdenk> | 2004-03-14 00:59:59 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2004-03-14 00:59:59 +0000 |
commit | c3f9d4939af90eb8e30119601c86c05bde6c7345 (patch) | |
tree | 90854c0902fd963de17ee275e3836629892a060f /lib_generic | |
parent | 0e6d798cb313580acd06ba01626687a557c5159f (diff) | |
download | u-boot-imx-c3f9d4939af90eb8e30119601c86c05bde6c7345.zip u-boot-imx-c3f9d4939af90eb8e30119601c86c05bde6c7345.tar.gz u-boot-imx-c3f9d4939af90eb8e30119601c86c05bde6c7345.tar.bz2 |
* Patch by Yuli Barcohen, 4 Mar 2004:
Fix problems with GCC 3.3.x which changed handling of global
variables explicitly initialized to zero (now in .bss instead of
.data as before).
* Patch by Leon Kukovec, 02 Mar 2004:
add strswab() to fix IDE LBA capacity, firmware and model numbers
on little endian machines
* Patch by Masami Komiya, 02 Mar 2004:
- Remove get_ticks() from NFS code
- Add verification of RPC transaction ID
* Patch by Pierre Aubert, 02 Mar 2004:
cleanup for IDE and USB drivers for MPC5200
Diffstat (limited to 'lib_generic')
-rw-r--r-- | lib_generic/string.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib_generic/string.c b/lib_generic/string.c index d06a645..5ba8d7c 100644 --- a/lib_generic/string.c +++ b/lib_generic/string.c @@ -364,6 +364,33 @@ 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; + + if ((NULL == s) || ('\0' == *s)) { + return (NULL); + } + + for (p = ((char *)s + 1); '\0' != *p; p += 2) { + char tmp; + tmp = *(p-1); + *(p-1) = *p; + *p = tmp; + } + + return (char *) s; +} +#endif + #ifndef __HAVE_ARCH_MEMSET /** * memset - Fill a region of memory with the given value |