Linux bluetooth development
 help / color / mirror / Atom feed
From: Giovanni Gherdovich <g.gherdovich@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Giovanni Gherdovich <g.gherdovich@gmail.com>
Subject: [PATCH 2/2] AVCTP: Replace calls to g_queue_free_full function
Date: Thu,  3 Jan 2013 20:37:15 +0100	[thread overview]
Message-ID: <1357241835-4861-1-git-send-email-g.gherdovich@gmail.com> (raw)

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


             reply	other threads:[~2013-01-03 19:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-03 19:37 Giovanni Gherdovich [this message]
2013-01-03 21:00 ` [PATCH 2/2] AVCTP: Replace calls to g_queue_free_full function 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-01 11:21 Giovanni Gherdovich
2013-01-02  1:19 ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357241835-4861-1-git-send-email-g.gherdovich@gmail.com \
    --to=g.gherdovich@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox