From: Marcel Holtmann <marcel@holtmann.org>
To: Giovanni Gherdovich <g.gherdovich@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 1/2] core: Replace calls to g_queue_free_full function
Date: Wed, 02 Jan 2013 14:08:08 -0800 [thread overview]
Message-ID: <1357164488.19248.92.camel@aeonflux> (raw)
In-Reply-To: <1357162287-14216-1-git-send-email-g.gherdovich@gmail.com>
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 "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);
> +}
> +
I would have done this:
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 +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);
>
Regards
Marcel
next prev parent reply other threads:[~2013-01-02 22:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-02 21:31 [PATCH 1/2] core: Replace calls to g_queue_free_full function Giovanni Gherdovich
2013-01-02 22:08 ` Marcel Holtmann [this message]
2013-01-03 19:36 ` Giovanni Gherdovich
-- strict thread matches above, loose matches on Subject: below --
2013-01-03 19:37 Giovanni Gherdovich
2013-01-03 21:00 ` Marcel Holtmann
2013-01-01 11:21 Giovanni Gherdovich
2013-01-02 1:18 ` 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=1357164488.19248.92.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=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