use g_strsplit to save work
This commit is contained in:
parent
e7e51c3ef7
commit
8085f3490f
1 changed files with 7 additions and 13 deletions
|
@ -262,20 +262,14 @@ gboolean parse_attr_contains(const char *val, xmlNodePtr node,
|
||||||
static GSList* split_paths(const gchar *paths)
|
static GSList* split_paths(const gchar *paths)
|
||||||
{
|
{
|
||||||
GSList *list = NULL;
|
GSList *list = NULL;
|
||||||
gchar *c, *e, *s;
|
gchar **spl, **it;
|
||||||
|
|
||||||
c = g_strdup(paths);
|
if (!paths)
|
||||||
s = c;
|
return NULL;
|
||||||
e = c - 1;
|
spl = g_strsplit(paths, ":", -1);
|
||||||
while ((e = strchr(e + 1, ':'))) {
|
for (it = spl; *it; ++it)
|
||||||
*e = '\0';
|
list = g_slist_append(list, *it);
|
||||||
if (s[0] != '\0')
|
g_free(spl);
|
||||||
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);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue