summaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-11-15 15:56:10 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2015-11-15 15:56:10 +0100
commit9b22d72fd1adea33bbe77887bdde558c9132acd2 (patch)
tree3b572961a45dca2c8fff94ff02e168fd105b85dd /common.c
parentf11635ed7fadaf10f761d9ccaadd30c40d7dfc14 (diff)
downloadxK-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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common.c b/common.c
index 21634d4..0ae0a61 100644
--- a/common.c
+++ b/common.c
@@ -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;