diff options
| author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-03-11 19:29:12 +0000 | 
|---|---|---|
| committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2008-03-11 19:29:12 +0000 | 
| commit | 2c52650872bdeede320c4192bc0ac06c029f2732 (patch) | |
| tree | 42ac66424371b29ffb9d25fb3e0fca2f34286401 | |
| parent | f5b7c429b4d9fe8e83bf2e598e72084c83f77a0f (diff) | |
added bt_string2list function
| -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); | 
