Code

colors, utils: use g_list_free_full(g_free)
authorMax Kellermann <max.kellermann@gmail.com>
Tue, 21 Mar 2017 21:05:10 +0000 (22:05 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Tue, 21 Mar 2017 21:05:10 +0000 (22:05 +0100)
src/colors.c
src/utils.c

index 3b100bc22f3c06ea30614b69a48d0710a133f44d..5a79fd9bbfff8b2c6a7967e499af18df19c98544 100644 (file)
@@ -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;
        }
 }
index d46f521f53b9ff9e816e9b1898d7145d85ef6b58..3f327f4b0b80914025e6e925452114ed56ef1417 100644 (file)
 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;
 }