summaryrefslogtreecommitdiff
path: root/parser/parse.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-10-15 03:11:59 +0000
committerDana Jansens <danakj@orodu.net>2003-10-15 03:11:59 +0000
commit8085f3490fb5790d15fcb47988bbc24e17467725 (patch)
treef011cd3d8c70801ed5315466ffdfc0cf72c6e868 /parser/parse.c
parente7e51c3ef72d7d9fa8fd1c7266b88765ece1dc67 (diff)
use g_strsplit to save work
Diffstat (limited to 'parser/parse.c')
-rw-r--r--parser/parse.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/parser/parse.c b/parser/parse.c
index a791073b..de7bba6e 100644
--- a/parser/parse.c
+++ b/parser/parse.c
@@ -262,20 +262,14 @@ gboolean parse_attr_contains(const char *val, xmlNodePtr node,
static GSList* split_paths(const gchar *paths)
{
GSList *list = NULL;
- gchar *c, *e, *s;
+ gchar **spl, **it;
- c = g_strdup(paths);
- s = c;
- e = c - 1;
- while ((e = strchr(e + 1, ':'))) {
- *e = '\0';
- if (s[0] != '\0')
- list = g_slist_append(list, g_strdup(s));
- s = e + 1;
- }
- if (s[0] != '\0')
- list = g_slist_append(list, g_strdup(s));
- g_free(c);
+ if (!paths)
+ return NULL;
+ spl = g_strsplit(paths, ":", -1);
+ for (it = spl; *it; ++it)
+ list = g_slist_append(list, *it);
+ g_free(spl);
return list;
}