summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ernberg <john.ernberg@actia.se>2016-04-22 13:10:06 +0000
committerDenis Kenzior <denkenz@gmail.com>2016-04-22 15:23:22 -0500
commita34bf08359ec2906d8de5077d4bf009570054dcd (patch)
tree83fa6d00e390b9cfa61e4ef9ae349c15332b67c2
parent3f12d06b2006d0fe9c2b46ae92978514af9b749c (diff)
downloadofono-a34bf08359ec2906d8de5077d4bf009570054dcd.tar.gz
gatchat: Use g_slist_free_full
-rw-r--r--gatchat/gatchat.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index d7d00605..3f290ac2 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -305,8 +305,9 @@ static void at_command_destroy(struct at_command *cmd)
g_free(cmd);
}
-static void free_terminator(struct terminator_info *info)
+static void free_terminator(gpointer pointer)
{
+ struct terminator_info *info = pointer;
g_free(info->terminator);
info->terminator = NULL;
g_free(info);
@@ -325,8 +326,7 @@ static void chat_cleanup(struct at_chat *chat)
chat->command_queue = NULL;
/* Cleanup any response lines we have pending */
- g_slist_foreach(chat->response_lines, (GFunc)g_free, NULL);
- g_slist_free(chat->response_lines);
+ g_slist_free_full(chat->response_lines, g_free);
chat->response_lines = NULL;
/* Cleanup registered notifications */
@@ -357,9 +357,7 @@ static void chat_cleanup(struct at_chat *chat)
chat->syntax = NULL;
if (chat->terminator_list) {
- g_slist_foreach(chat->terminator_list,
- (GFunc)free_terminator, NULL);
- g_slist_free(chat->terminator_list);
+ g_slist_free_full(chat->terminator_list, free_terminator);
chat->terminator_list = NULL;
}
}
@@ -461,8 +459,7 @@ static void at_chat_finish_command(struct at_chat *p, gboolean ok, char *final)
cmd->callback(ok, &result, cmd->user_data);
}
- g_slist_foreach(response_lines, (GFunc)g_free, NULL);
- g_slist_free(response_lines);
+ g_slist_free_full(response_lines, g_free);
g_free(final);
at_command_destroy(cmd);