Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/2] core: Replace calls to g_queue_free_full function
@ 2013-01-01 11:21 Giovanni Gherdovich
  2013-01-02  1:18 ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Giovanni Gherdovich @ 2013-01-01 11:21 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Giovanni Gherdovich

The function g_queue_free_full is available only from GLib 2.32.
If BlueZ has to build against GLib 2.28, as stated in the configure.ac,
this patch replaces the calls to g_queue_free_full in the "core" BlueZ module
with its body, taken from the sources of GLib 2.32.
---
 src/adapter.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index e71cea8..73c9e58 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1697,7 +1697,8 @@ static void adapter_free(gpointer user_data)
 	if (adapter->auth_idle_id)
 		g_source_remove(adapter->auth_idle_id);
 
-	g_queue_free_full(adapter->auths, g_free);
+	g_queue_foreach(adapter->auths, (GFunc)g_free, NULL);
+	g_queue_free(adapter->auths);
 
 	sdp_list_free(adapter->services, NULL);
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 1/2] core: Replace calls to g_queue_free_full function
@ 2013-01-02 21:31 Giovanni Gherdovich
  2013-01-02 22:08 ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Giovanni Gherdovich @ 2013-01-02 21:31 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Giovanni Gherdovich

The function g_queue_free_full is available only from GLib 2.32.
If BlueZ has to build against GLib 2.28, as stated in the configure.ac,
this patch replaces the calls to g_queue_free_full in the "core" BlueZ module
with its body, taken from the sources of GLib 2.32.
---
 src/adapter.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index e71cea8..f7fc00e 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1688,6 +1688,15 @@ int btd_adapter_stop(struct btd_adapter *adapter)
 	return 0;
 }
 
+static void g_free_wrapper(gpointer mem, gpointer dummy)
+{
+	/* 
+	 * Wrapper around GLib's g_free to match the signature
+	 * required for the second argument of g_queue_foreach.
+	 */
+	g_free(mem);
+}
+
 static void adapter_free(gpointer user_data)
 {
 	struct btd_adapter *adapter = user_data;
@@ -1697,7 +1706,8 @@ static void adapter_free(gpointer user_data)
 	if (adapter->auth_idle_id)
 		g_source_remove(adapter->auth_idle_id);
 
-	g_queue_free_full(adapter->auths, g_free);
+	g_queue_foreach(adapter->auths, g_free_wrapper, NULL);
+	g_queue_free(adapter->auths);
 
 	sdp_list_free(adapter->services, NULL);
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 1/2] core: Replace calls to g_queue_free_full function
@ 2013-01-03 19:37 Giovanni Gherdovich
  2013-01-03 21:00 ` Marcel Holtmann
  0 siblings, 1 reply; 7+ messages in thread
From: Giovanni Gherdovich @ 2013-01-03 19:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Giovanni Gherdovich

The function g_queue_free_full is available only from GLib 2.32.
If BlueZ has to build against GLib 2.28, as stated in the configure.ac,
this patch replaces the calls to g_queue_free_full in the "core" BlueZ module
with its body, taken from the sources of GLib 2.32.
---
 src/adapter.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index e71cea8..ca94fa9 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1688,6 +1688,13 @@ int btd_adapter_stop(struct btd_adapter *adapter)
 	return 0;
 }
 
+static void free_service_auth(gpointer data, gpointer user_data)
+{
+	struct service_auth *auth = data;
+
+	g_free(auth);
+}
+
 static void adapter_free(gpointer user_data)
 {
 	struct btd_adapter *adapter = user_data;
@@ -1697,7 +1704,8 @@ static void adapter_free(gpointer user_data)
 	if (adapter->auth_idle_id)
 		g_source_remove(adapter->auth_idle_id);
 
-	g_queue_free_full(adapter->auths, g_free);
+	g_queue_foreach(adapter->auths, free_service_auth, NULL);
+	g_queue_free(adapter->auths);
 
 	sdp_list_free(adapter->services, NULL);
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-03 21:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-01 11:21 [PATCH 1/2] core: Replace calls to g_queue_free_full function Giovanni Gherdovich
2013-01-02  1:18 ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2013-01-02 21:31 Giovanni Gherdovich
2013-01-02 22:08 ` Marcel Holtmann
2013-01-03 19:36   ` Giovanni Gherdovich
2013-01-03 19:37 Giovanni Gherdovich
2013-01-03 21:00 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox