* 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
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 @@
}
#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