#include <linux/ctype.h>
#include <malloc.h>
-#ifdef CONFIG_ARM
-#undef __HAVE_ARCH_MEMCMP
-#undef __HAVE_ARCH_MEMCPY
-#undef __HAVE_ARCH_MEMMOVE
-#undef __HAVE_ARCH_MEMSET
-#undef __HAVE_ARCH_BCOPY
-#undef __HAVE_ARCH_STRCAT
-#undef __HAVE_ARCH_STRCHR
-#undef __HAVE_ARCH_STRCMP
-#undef __HAVE_ARCH_STRCPY
-#undef __HAVE_ARCH_STRLEN
-#undef __HAVE_ARCH_STRNCPY
-#else
-#define __HAVE_ARCH_MEMCMP
-#define __HAVE_ARCH_MEMCPY
-#define __HAVE_ARCH_MEMMOVE
-#define __HAVE_ARCH_MEMSET
-#define __HAVE_ARCH_BCOPY
-#define __HAVE_ARCH_STRCAT
-#define __HAVE_ARCH_STRCMP
-#define __HAVE_ARCH_STRCPY
-#define __HAVE_ARCH_STRLEN
-#define __HAVE_ARCH_STRNCPY
-#endif
-#ifndef __HAVE_ARCH_STRNICMP
+#if 0 /* not used - was: #ifndef __HAVE_ARCH_STRNICMP */
/**
* strnicmp - Case insensitive, length-limited string comparison
* @s1: One string
{
const char *p = s + strlen(s);
do {
- if (*p == (char)c)
- return (char *)p;
+ if (*p == (char)c)
+ return (char *)p;
} while (--p >= s);
return NULL;
}
}
#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
p++;
size--;
}
- return (void *) p;
+ return (void *) p;
}
#endif
{
const unsigned char *p = s;
while (n-- != 0) {
- if ((unsigned char)c == *p++) {
+ if ((unsigned char)c == *p++) {
return (void *)(p-1);
}
}