diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-11-15 15:56:10 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-11-15 15:56:10 +0100 |
commit | 9b22d72fd1adea33bbe77887bdde558c9132acd2 (patch) | |
tree | 3b572961a45dca2c8fff94ff02e168fd105b85dd /common.c | |
parent | f11635ed7fadaf10f761d9ccaadd30c40d7dfc14 (diff) | |
download | xK-9b22d72fd1adea33bbe77887bdde558c9132acd2.tar.gz xK-9b22d72fd1adea33bbe77887bdde558c9132acd2.tar.xz xK-9b22d72fd1adea33bbe77887bdde558c9132acd2.zip |
Extend split_str() for multiple split chars
Diffstat (limited to 'common.c')
-rw-r--r-- | common.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -44,10 +44,10 @@ // --- To be moved to liberty -------------------------------------------------- static void -split_str (const char *s, char delimiter, struct str_vector *out) +split_str (const char *s, const char *delimiters, struct str_vector *out) { const char *begin = s, *end; - while ((end = strchr (begin, delimiter))) + while ((end = strpbrk (begin, delimiters))) { str_vector_add_owned (out, xstrndup (begin, end - begin)); begin = ++end; @@ -1245,7 +1245,7 @@ config_item_get (struct config_item *self, const char *path, struct error **e) struct str_vector v; str_vector_init (&v); - split_str (path, '.', &v); + split_str (path, ".", &v); struct config_item *result = NULL; size_t i = 0; |