[dovecot-cvs] dovecot/src/lib strfuncs.c,1.50,1.51

cras at dovecot.org cras at dovecot.org
Fri Dec 30 22:06:12 EET 2005


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv13895

Modified Files:
	strfuncs.c 
Log Message:
*_strsplit_spaces() was skipping only space separators, while it should have
skipped all (like its API comments said).



Index: strfuncs.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/strfuncs.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- strfuncs.c	25 Sep 2005 10:52:27 -0000	1.50
+++ strfuncs.c	30 Dec 2005 20:06:10 -0000	1.51
@@ -504,8 +504,11 @@
 
 	i_assert(*separators != '\0');
 
-	if (spaces)
-		while (*data == ' ') data++;
+	if (spaces) {
+		/* skip leading separators */
+		while (strchr(separators, *data) != NULL)
+			data++;
+	}
 	if (*data == '\0')
 		return p_new(pool, char *, 1);
 
@@ -527,13 +530,12 @@
 				alloc_count = new_alloc_count;
 			}
 
-			if (*str != ' ' || !spaces)
-				*str = '\0';
-			else {
-				*str = '\0';
-				while (str[1] == ' ') str++;
+			*str = '\0';
+			if (spaces) {
+				while (strchr(separators, str[1]) != NULL)
+					str++;
 
-				/* ignore trailing spaces */
+				/* ignore trailing separators */
 				if (str[1] == '\0')
 					break;
 			}



More information about the dovecot-cvs mailing list