summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-10 20:01:52 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-10 20:01:52 +0000
commitb583273d911d67eb202f3f367f18d4460913ad41 (patch)
tree4393c7a8d57a4f4b8a4eb1450f86bffe83130f9a /common
parentf4662ad94310c08fd83e2cd9acd4ab0a03379cee (diff)
added list2string function
Diffstat (limited to 'common')
-rw-r--r--common/glib-helper.c16
-rw-r--r--common/glib-helper.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/common/glib-helper.c b/common/glib-helper.c
index eef6ad8d..001bb4fc 100644
--- a/common/glib-helper.c
+++ b/common/glib-helper.c
@@ -257,3 +257,19 @@ char *bt_uuid2string(uuid_t *uuid)
return str;
}
+
+gchar *bt_list2string(GSList *list)
+{
+ GSList *l;
+ gchar *str = NULL;
+
+ if (!list)
+ return NULL;
+
+ str = g_strdup((const gchar *) list->data);
+
+ for (l = list->next; l; l = l->next)
+ str = g_strconcat(str, ", " , (const gchar *) l->data, NULL);
+
+ return str;
+}
diff --git a/common/glib-helper.h b/common/glib-helper.h
index e64eccca..7cfdc5dc 100644
--- a/common/glib-helper.h
+++ b/common/glib-helper.h
@@ -28,3 +28,4 @@ int bt_discover_services(const bdaddr_t *src, const bdaddr_t *dst,
bt_callback_t cb, void *user_data, bt_destroy_t destroy);
gchar *bt_uuid2string(uuid_t *uuid);
+gchar *bt_list2string(GSList *list);