src/lib/common.c 1.148

1.148 2010/04/20 15:56:50 markd
made parameter name C++ friendly
Index: src/lib/common.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/common.c,v
retrieving revision 1.147
retrieving revision 1.148
diff -b -B -U 4 -r1.147 -r1.148
--- src/lib/common.c	15 Apr 2010 19:24:53 -0000	1.147
+++ src/lib/common.c	20 Apr 2010 15:56:50 -0000	1.148
@@ -1229,25 +1229,25 @@
 strcpy(resultPtr, string);
 return result;
 }
 
-int strSwapStrs(char *string, int sz,char *old, char *new)
-/* Swaps all occurnces of the old with the new in string. Need not be same size
+int strSwapStrs(char *string, int sz,char *oldStr, char *newStr)
+/* Swaps all occurrences of the old with the new in string. Need not be same size
    Swaps in place but restricted by sz.  Returns count of swaps or -1 for sz failure. */
 {
 // WARNING: called at low level, so no errors allowed.
 int count = 0;
 char *p=NULL;
-for(p=strstr(string,old);p!=NULL;p=strstr(p+strlen(old),old))
+for(p=strstr(string,oldStr);p!=NULL;p=strstr(p+strlen(oldStr),oldStr))
     count++;
 if(count == 0)
     return 0;
-if((strlen(string)+(count*(strlen(new) - strlen(old))))>=sz)
+if((strlen(string)+(count*(strlen(newStr) - strlen(oldStr))))>=sz)
     return -1;
-for(p=strstr(string,old);p!=NULL;p=strstr(p+strlen(new),old))
+for(p=strstr(string,oldStr);p!=NULL;p=strstr(p+strlen(newStr),oldStr))
     {
-    memmove(p+strlen(new),p+strlen(old),strlen(p+strlen(old))+1); // NULL at end is also moved!
-    memcpy(p,new,strlen(new));
+    memmove(p+strlen(newStr),p+strlen(oldStr),strlen(p+strlen(oldStr))+1); // NULL at end is also moved!
+    memcpy(p,newStr,strlen(newStr));
     }
 return count;
 }