From: Max Kellermann Date: Tue, 21 Mar 2017 21:05:10 +0000 (+0100) Subject: colors, utils: use g_list_free_full(g_free) X-Git-Tag: v0.27~12 X-Git-Url: https://git.tokkee.org/?p=ncmpc.git;a=commitdiff_plain;h=8a4cbdf7b257d0cefb5af6ad5a964736f08ef17f colors, utils: use g_list_free_full(g_free) --- 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; }