[MPlayer-cvslog] r33136 - trunk/gui/util/string.c

ib subversion at mplayerhq.hu
Mon Mar 28 18:03:27 CEST 2011


Author: ib
Date: Mon Mar 28 18:03:26 2011
New Revision: 33136

Log:
Simplify strswap().

(A special return value for empty strings isn't needed.)

Modified:
   trunk/gui/util/string.c

Modified: trunk/gui/util/string.c
==============================================================================
--- trunk/gui/util/string.c	Mon Mar 28 17:51:20 2011	(r33135)
+++ trunk/gui/util/string.c	Mon Mar 28 18:03:26 2011	(r33136)
@@ -23,14 +23,14 @@
 
 char *strswap(char *in, char from, char to)
 {
-    int i;
+    char *p = in;
 
-    if (!*in)
-        return NULL;
+    while (*p) {
+        if (*p == from)
+            *p = to;
 
-    for (i = 0; in[i]; i++)
-        if (in[i] == from)
-            in[i] = to;
+        p++;
+    }
 
     return in;
 }


More information about the MPlayer-cvslog mailing list