strv: make strv_split() accept empty string

This commit is contained in:
Yu Watanabe
2018-07-07 01:34:18 +09:00
parent 8255430754
commit 0745ce7565
2 changed files with 28 additions and 4 deletions
+4
View File
@@ -253,6 +253,10 @@ char **strv_split(const char *s, const char *separator) {
assert(s);
s += strspn(s, separator);
if (isempty(s))
return new0(char*, 1);
n = 0;
FOREACH_WORD_SEPARATOR(word, l, s, separator, state)
n++;