From 8a4cbdf7b257d0cefb5af6ad5a964736f08ef17f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 21 Mar 2017 22:05:10 +0100 Subject: [PATCH] colors, utils: use g_list_free_full(g_free) --- src/colors.c | 9 +-------- src/utils.c | 10 +--------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/colors.c b/src/colors.c index 3b100bc..5a79fd9 100644 --- a/src/colors.c +++ b/src/colors.c @@ -240,14 +240,7 @@ colors_start(void) /* free the color_definition_list */ if (color_definition_list) { - GList *list = color_definition_list; - - while (list) { - g_free(list->data); - list=list->next; - } - - g_list_free(color_definition_list); + g_list_free_full(color_definition_list, g_free); color_definition_list = NULL; } } diff --git a/src/utils.c b/src/utils.c index d46f521..3f327f4 100644 --- a/src/utils.c +++ b/src/utils.c @@ -30,15 +30,7 @@ GList * string_list_free(GList *string_list) { - GList *list = g_list_first(string_list); - - while (list) { - g_free(list->data); - list->data = NULL; - list = list->next; - } - - g_list_free(string_list); + g_list_free_full(string_list, g_free); return NULL; } -- 2.30.2