Explorar el Código

* Using stdarg's new rmspace()

svn: 426
Bryan Drewery hace 22 años
padre
commit
d86dcb91d8
Se han modificado 1 ficheros con 5 adiciones y 5 borrados
  1. 5 5
      src/chanprog.c

+ 5 - 5
src/chanprog.c

@@ -53,22 +53,22 @@ char 			botname[NICKLEN + 1];	/* Primary botname		*/
 void rmspace(char *s)
 void rmspace(char *s)
 {
 {
 #define whitespace(c) (((c) == 32) || ((c) == 9) || ((c) == 13) || ((c) == 10))
 #define whitespace(c) (((c) == 32) || ((c) == 9) || ((c) == 13) || ((c) == 10))
-  char *p;
+  char *p, *end;
   int len;
   int len;
 
 
   if (!*s)
   if (!*s)
     return;
     return;
 
 
   /* Wipe end of string */
   /* Wipe end of string */
-  for (p = s + strlen(s) - 1; ((whitespace(*p)) && (p >= s)); p--);
-  if (p != s + strlen(s) - 1)
-    *(p + 1) = 0;
+  end = s + strlen(s) - 1;
+  for (p = end; ((whitespace(*p)) && (p >= s)); p--);
+  if (p != end) *(p + 1) = 0;
   len = p+1 - s;
   len = p+1 - s;
   for (p = s; ((whitespace(*p)) && (*p)); p++);
   for (p = s; ((whitespace(*p)) && (*p)); p++);
   len -= (p - s);
   len -= (p - s);
   if (p != s) {
   if (p != s) {
     /* +1 to include the null in the copy */
     /* +1 to include the null in the copy */
-    memmove(s, p, len+1);
+    memmove(s, p, len + 1);
   }
   }
 }
 }