From: John Ernberg <john.ernberg@actia.se>
To: ofono@ofono.org
Subject: Re: [PATCH 20/24] stk: don't rely on undefined behavior when casting function pointers
Date: Mon, 25 Apr 2016 06:38:42 +0000 [thread overview]
Message-ID: <571DBB6D.8010207@actia.se> (raw)
In-Reply-To: <571A8D27.6060006@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1818 bytes --]
Hi Dennis,
On 04/22/2016 10:44 PM, Denis Kenzior wrote:
> Hi John,
>
> On 04/22/2016 08:10 AM, John Ernberg wrote:
>> From: John Ernberg <john.ernberg@actia.se>
>>
>> ---
>> src/stk.c | 10 +++++++---
>> 1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/stk.c b/src/stk.c
>> index 01c95b5..16c7152 100644
>> --- a/src/stk.c
>> +++ b/src/stk.c
>> @@ -2315,8 +2315,7 @@ static gboolean handle_command_refresh(const
>> struct stk_command *cmd,
>> break;
>> }
>>
>> - g_slist_foreach(file_list, (GFunc) g_free, NULL);
>> - g_slist_free(file_list);
>> + g_slist_free_full(file_list, g_free);
>>
>> return FALSE;
>> }
>> @@ -3131,6 +3130,11 @@ void ofono_stk_driver_unregister(const struct
>> ofono_stk_driver *d)
>> g_drivers = g_slist_remove(g_drivers, (void *) d);
>> }
>>
>> +static void free_envelope_item(gpointer pointer, gpointer user_data)
>> +{
>> + g_free(pointer);
>> +}
>> +
>> static void stk_unregister(struct ofono_atom *atom)
>> {
>> struct ofono_stk *stk = __ofono_atom_get_data(atom);
>> @@ -3163,7 +3167,7 @@ static void stk_unregister(struct ofono_atom
>> *atom)
>> stk->main_menu = NULL;
>> }
>>
>> - g_queue_foreach(stk->envelope_q, (GFunc) g_free, NULL);
>> + g_queue_foreach(stk->envelope_q, free_envelope_item, NULL);
>
> Why not g_queue_free_full?
It would require a glib required version bump from 2.28 to 2.32, the
solution in the patch is 2.28 friendly. If it's ok to bump glib, I will
redo the patch to use g_queue_free_full instead.
>
>> g_queue_free(stk->envelope_q);
>>
>> ofono_modem_remove_interface(modem, OFONO_STK_INTERFACE);
>>
>
> Regards,
> -Denis
Best regards // John Ernberg
next prev parent reply other threads:[~2016-04-25 6:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 13:10 [PATCH 00/24] [RFC] Don't rely on undefined behavior when casting function pointers John Ernberg
2016-04-22 13:10 ` [PATCH 01/24] atmodem: don't " John Ernberg
2016-04-22 13:10 ` [PATCH 02/24] hfpmodem: " John Ernberg
2016-04-22 13:10 ` [PATCH 03/24] ifxmodem: " John Ernberg
2016-04-22 13:10 ` [PATCH 04/24] ril: " John Ernberg
2016-04-22 13:10 ` [PATCH 05/24] stemodem: " John Ernberg
2016-04-22 13:10 ` [PATCH 06/24] gatchat: " John Ernberg
2016-04-22 13:10 ` [PATCH 07/24] bluez4: " John Ernberg
2016-04-22 13:10 ` [PATCH 08/24] sm: " John Ernberg
2016-04-22 13:10 ` [PATCH 09/24] cbs: " John Ernberg
2016-04-22 13:10 ` [PATCH 10/24] cdma/sms: " John Ernberg
2016-04-22 13:10 ` [PATCH 11/24] handsfree: " John Ernberg
2016-04-22 13:10 ` [PATCH 12/24] modem: " John Ernberg
2016-04-22 13:10 ` [PATCH 13/24] network: " John Ernberg
2016-04-22 13:10 ` [PATCH 14/24] phonebook: " John Ernberg
2016-04-22 13:10 ` [PATCH 15/24] sim: " John Ernberg
2016-04-22 13:10 ` [PATCH 16/24] simfs: " John Ernberg
2016-04-22 13:10 ` [PATCH 17/24] simutil: " John Ernberg
2016-04-22 13:10 ` [PATCH 18/24] sms: " John Ernberg
2016-04-22 13:10 ` [PATCH 19/24] smsutil: " John Ernberg
2016-04-22 13:10 ` [PATCH 20/24] stk: " John Ernberg
2016-04-22 13:10 ` [PATCH 21/24] stkutil: " John Ernberg
2016-04-22 13:10 ` [PATCH 22/24] ussd: " John Ernberg
2016-04-22 13:10 ` [PATCH 23/24] voicecall: " John Ernberg
2016-04-22 13:10 ` [PATCH 24/24] unittest: " John Ernberg
2016-04-22 20:44 ` [PATCH 20/24] stk: " Denis Kenzior
2016-04-25 6:38 ` John Ernberg [this message]
2016-04-25 17:21 ` Denis Kenzior
2016-04-22 20:42 ` [PATCH 00/24] [RFC] Don't " Denis Kenzior
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=571DBB6D.8010207@actia.se \
--to=john.ernberg@actia.se \
--cc=ofono@ofono.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