diff options
-rw-r--r-- | common/glib-helper.c | 24 | ||||
-rw-r--r-- | common/glib-helper.h | 1 |
2 files changed, 25 insertions, 0 deletions
diff --git a/common/glib-helper.c b/common/glib-helper.c index cb8f35c4..771b9d76 100644 --- a/common/glib-helper.c +++ b/common/glib-helper.c @@ -277,3 +277,27 @@ gchar *bt_list2string(GSList *list) return str; } + +GSList *bt_string2list(const gchar *str) +{ + GSList *l = NULL; + gchar **uuids; + int i = 0; + + if (!str) + return NULL; + + /* FIXME: eglib doesn't support g_strsplit */ + uuids = g_strsplit(str, " ", 0); + if (!uuids) + return NULL; + + while (uuids[i]) { + l = g_slist_append(l, uuids[i]); + i++; + } + + g_free(uuids); + + return l; +} diff --git a/common/glib-helper.h b/common/glib-helper.h index 7cfdc5dc..ed724af6 100644 --- a/common/glib-helper.h +++ b/common/glib-helper.h @@ -29,3 +29,4 @@ int bt_discover_services(const bdaddr_t *src, const bdaddr_t *dst, gchar *bt_uuid2string(uuid_t *uuid); gchar *bt_list2string(GSList *list); +GSList *bt_string2list(const gchar *str); |