# HG changeset patch # User Timo Sirainen # Date 1135973170 -7200 # Node ID 91689264d812501812ca0c63d5a5efaa330fa5eb # Parent 39c2936358754ce781fed56ecd153a1c6c053e48 *_strsplit_spaces() was skipping only space separators, while it should have skipped all (like its API comments said). diff -r 39c293635875 -r 91689264d812 src/lib/strfuncs.c --- a/src/lib/strfuncs.c Fri Dec 30 21:49:38 2005 +0200 +++ b/src/lib/strfuncs.c Fri Dec 30 22:06:10 2005 +0200 @@ -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; }