]> git.sur5r.net Git - u-boot/blobdiff - lib_generic/string.c
POST: replace the LOGBUFF_INITIALIZED flag in gd->post_log_word (1 << 31) with the...
[u-boot] / lib_generic / string.c
index 5ba8d7cb514e6561af04c6e3251014a07e5a60d1..e0b793abbee5106e5614f51f7876fd1e6be1d5e5 100644 (file)
@@ -21,7 +21,7 @@
 #include <malloc.h>
 
 
-#ifndef __HAVE_ARCH_STRNICMP
+#if 0 /* not used - was: #ifndef __HAVE_ARCH_STRNICMP */
 /**
  * strnicmp - Case insensitive, length-limited string comparison
  * @s1: One string
@@ -374,17 +374,18 @@ char * strsep(char **s, const char *ct)
  */
 char *strswab(const char *s)
 {
-       char *p;
+       char *p, *q;
 
        if ((NULL == s) || ('\0' == *s)) {
                return (NULL);
        }
 
-       for (p = ((char *)s + 1); '\0' != *p; p += 2) {
+       for (p=(char *)s, q=p+1; (*p != '\0') && (*q != '\0'); p+=2, q+=2) {
                char  tmp;
-               tmp = *(p-1);
-               *(p-1) = *p;
-               *p = tmp;
+
+               tmp = *p;
+               *p  = *q;
+               *q  = tmp;
        }
 
        return (char *) s;