changeset 24894:cead8692e35f

Terminate the loop on the first null-character. (Currently it would not terminate for the first null in, e.g. "1 2 \0 3")
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 06 Jan 2009 19:50:18 +0000
parents 253e5d3988ca
children b15168f2b7ee
files libpurple/protocols/myspace/myspace.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Tue Jan 06 16:19:16 2009 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Tue Jan 06 19:50:18 2009 +0000
@@ -2876,10 +2876,9 @@
 	}
 
 	/* Strip spaces. */
-	for (i=0, j=0; normalized[j]; i++, j++) {
-		while (normalized[j] == ' ')
-			j++;
-		normalized[i] = normalized[j];
+	for (i=0, j=0; normalized[j]; j++) {
+		if (normalized[j] != ' ')
+			normalized[i++] = normalized[j];
 	}
 	normalized[i] = '\0';