Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 2/2] AVCTP: Replace calls to g_queue_free_full function
@ 2013-01-01 11:21 Giovanni Gherdovich
  2013-01-02  1:19 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ 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 AVTCP module
with its body, taken from the sources of GLib 2.32.
---
 profiles/audio/avctp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 013c587..745ced8 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -395,7 +395,8 @@ static void avctp_channel_destroy(struct avctp_channel *chan)
 		g_source_remove(chan->process_id);
 
 	g_free(chan->buffer);
-	g_queue_free_full(chan->queue, pending_destroy);
+	g_queue_foreach(chan->queue, (GFunc)pending_destroy, NULL);
+	g_queue_free(chan->queue);
 	g_slist_free_full(chan->processed, pending_destroy);
 	g_slist_free_full(chan->handlers, g_free);
 	g_free(chan);
-- 
1.7.4.1


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

* Re: [PATCH 2/2] AVCTP: Replace calls to g_queue_free_full function
  2013-01-01 11:21 [PATCH 2/2] AVCTP: Replace calls to g_queue_free_full function Giovanni Gherdovich
@ 2013-01-02  1:19 ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2013-01-02  1:19 UTC (permalink / raw)
  To: Giovanni Gherdovich; +Cc: linux-bluetooth

Hi Giovanni,

> 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 AVTCP module
> with its body, taken from the sources of GLib 2.32.
> ---
>  profiles/audio/avctp.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
> index 013c587..745ced8 100644
> --- a/profiles/audio/avctp.c
> +++ b/profiles/audio/avctp.c
> @@ -395,7 +395,8 @@ static void avctp_channel_destroy(struct avctp_channel *chan)
>  		g_source_remove(chan->process_id);
>  
>  	g_free(chan->buffer);
> -	g_queue_free_full(chan->queue, pending_destroy);
> +	g_queue_foreach(chan->queue, (GFunc)pending_destroy, NULL);On Tue, 2013-01-01 at 12:21 +0100, Giovanni Gherdovich wrote:

Same here. Provide a proper pending_destroy. The other places can just
call it with NULL as second parameter.

> +	g_queue_free(chan->queue);
>  	g_slist_free_full(chan->processed, pending_destroy);
>  	g_slist_free_full(chan->handlers, g_free);
>  	g_free(chan);

Regards

Marcel



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

* [PATCH 2/2] AVCTP: Replace calls to g_queue_free_full function
@ 2013-01-02 21:32 Giovanni Gherdovich
  2013-01-02 22:10 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Giovanni Gherdovich @ 2013-01-02 21:32 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 AVTCP module
with its body, taken from the sources of GLib 2.32.
---
 profiles/audio/avctp.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 013c587..7a5a096 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -383,6 +383,15 @@ static void pending_destroy(void *data)
 	g_free(req);
 }
 
+static void pending_destroy_wrapper(void *data, void *dummy)
+{
+	/*
+	 * Wrapper around pending_destroy to match the signature
+	 * required for the second argument of g_queue_foreach.
+	 */
+        pending_destroy(data);
+}
+
 static void avctp_channel_destroy(struct avctp_channel *chan)
 {
 	g_io_channel_shutdown(chan->io, TRUE, NULL);
@@ -395,7 +404,8 @@ static void avctp_channel_destroy(struct avctp_channel *chan)
 		g_source_remove(chan->process_id);
 
 	g_free(chan->buffer);
-	g_queue_free_full(chan->queue, pending_destroy);
+	g_queue_foreach(chan->queue, pending_destroy_wrapper, NULL);
+	g_queue_free(chan->queue);
 	g_slist_free_full(chan->processed, pending_destroy);
 	g_slist_free_full(chan->handlers, g_free);
 	g_free(chan);
-- 
1.7.4.1


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

* Re: [PATCH 2/2] AVCTP: Replace calls to g_queue_free_full function
  2013-01-02 21:32 Giovanni Gherdovich
@ 2013-01-02 22:10 ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2013-01-02 22:10 UTC (permalink / raw)
  To: Giovanni Gherdovich; +Cc: linux-bluetooth

Hi Giovanni,

> 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 AVTCP module
> with its body, taken from the sources of GLib 2.32.
> ---
>  profiles/audio/avctp.c |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
> index 013c587..7a5a096 100644
> --- a/profiles/audio/avctp.c
> +++ b/profiles/audio/avctp.c
> @@ -383,6 +383,15 @@ static void pending_destroy(void *data)
>  	g_free(req);
>  }
>  
> +static void pending_destroy_wrapper(void *data, void *dummy)
> +{
> +	/*
> +	 * Wrapper around pending_destroy to match the signature
> +	 * required for the second argument of g_queue_foreach.
> +	 */
> +        pending_destroy(data);
> +}
> +

change pending_destroy() to this:

	static void pending_destroy(gpointer data, gpointer user_data)
	{
		...
	}

And then fix the callers to add an extra NULL.

>  static void avctp_channel_destroy(struct avctp_channel *chan)
>  {
>  	g_io_channel_shutdown(chan->io, TRUE, NULL);
> @@ -395,7 +404,8 @@ static void avctp_channel_destroy(struct avctp_channel *chan)
>  		g_source_remove(chan->process_id);
>  
>  	g_free(chan->buffer);
> -	g_queue_free_full(chan->queue, pending_destroy);
> +	g_queue_foreach(chan->queue, pending_destroy_wrapper, NULL);
> +	g_queue_free(chan->queue);
>  	g_slist_free_full(chan->processed, pending_destroy);
>  	g_slist_free_full(chan->handlers, g_free);
>  	g_free(chan);

Regards

Marcel



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

* [PATCH 2/2] AVCTP: 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; 6+ 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 AVTCP module
with its body, taken from the sources of GLib 2.32.
---
 profiles/audio/avctp.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 013c587..b26abe5 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -370,7 +370,7 @@ static struct avctp_pdu_handler *find_handler(GSList *list, uint8_t opcode)
 	return NULL;
 }
 
-static void pending_destroy(void *data)
+static void pending_destroy(gpointer data, gpointer user_data)
 {
 	struct avctp_pending_req *req = data;
 
@@ -395,8 +395,10 @@ static void avctp_channel_destroy(struct avctp_channel *chan)
 		g_source_remove(chan->process_id);
 
 	g_free(chan->buffer);
-	g_queue_free_full(chan->queue, pending_destroy);
-	g_slist_free_full(chan->processed, pending_destroy);
+	g_queue_foreach(chan->queue, pending_destroy, NULL);
+	g_queue_free(chan->queue);
+	g_slist_foreach(chan->processed, pending_destroy, NULL);
+	g_slist_free(chan->processed);
 	g_slist_free_full(chan->handlers, g_free);
 	g_free(chan);
 }
@@ -540,7 +542,7 @@ static gboolean req_timeout(gpointer user_data)
 
 	p->timeout = 0;
 
-	pending_destroy(p);
+	pending_destroy(p, NULL);
 	chan->p = NULL;
 
 	if (chan->process_id == 0)
@@ -574,7 +576,7 @@ static gboolean process_queue(void *user_data)
 		if (p->process(p->data) == 0)
 			break;
 
-		pending_destroy(p);
+		pending_destroy(p, NULL);
 	}
 
 	if (p == NULL)
@@ -626,7 +628,7 @@ static void control_response(struct avctp_channel *control,
 			return;
 
 		control->processed = g_slist_remove(control->processed, p);
-		pending_destroy(p);
+		pending_destroy(p, NULL);
 
 		return;
 	}
-- 
1.7.4.1


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

* Re: [PATCH 2/2] AVCTP: Replace calls to g_queue_free_full function
  2013-01-03 19:37 Giovanni Gherdovich
@ 2013-01-03 21:00 ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2013-01-03 21:00 UTC (permalink / raw)
  To: Giovanni Gherdovich; +Cc: linux-bluetooth

Hi Giovanni,

> 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 AVTCP module
> with its body, taken from the sources of GLib 2.32.
> ---
>  profiles/audio/avctp.c |   14 ++++++++------
>  1 files changed, 8 insertions(+), 6 deletions(-)

patch has been applied.

Regards

Marcel



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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-01 11:21 [PATCH 2/2] AVCTP: Replace calls to g_queue_free_full function Giovanni Gherdovich
2013-01-02  1:19 ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2013-01-02 21:32 Giovanni Gherdovich
2013-01-02 22:10 ` Marcel Holtmann
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