Replace collection_list_free with g_list_free_full
authorArkadiy Illarionov <qarkai@gmail.com>
Wed, 19 Jul 2023 20:38:16 +0000 (23:38 +0300)
committerColin Clark <colin.clark@cclark.uk>
Sat, 22 Jul 2023 15:43:14 +0000 (16:43 +0100)
src/collect-io.cc
src/collect.cc
src/collect.h

index a97ad30..cc974c3 100644 (file)
@@ -92,7 +92,7 @@ static gboolean collection_load_private(CollectionData *cd, const gchar *path, C
 
                if (!append)
                        {
-                       collection_list_free(cd->list);
+                       g_list_free_full(cd->list, reinterpret_cast<GDestroyNotify>(collection_info_free));
                        cd->list = nullptr;
                        }
                }
index 8042d62..ee4c939 100644 (file)
@@ -125,18 +125,6 @@ gboolean collection_info_load_thumb_unused(CollectInfo *ci)
 }
 #pragma GCC diagnostic pop
 
-void collection_list_free(GList *list)
-{
-       GList *work;
-       work = list;
-       while (work)
-               {
-               collection_info_free(static_cast<CollectInfo *>(work->data));
-               work = work->next;
-               }
-       g_list_free(list);
-}
-
 /* an ugly static var, well what ya gonna do ? */
 static SortType collection_list_sort_method = SORT_NAME;
 
@@ -506,7 +494,7 @@ void collection_free(CollectionData *cd)
        DEBUG_1("collection \"%s\" freed", cd->name);
 
        collection_load_stop(cd);
-       collection_list_free(cd->list);
+       g_list_free_full(cd->list, reinterpret_cast<GDestroyNotify>(collection_info_free));
 
        file_data_unregister_notify_func(collection_notify_cb, cd);
 
index 35d38a1..b0e4881 100644 (file)
@@ -30,8 +30,6 @@ void collection_info_free(CollectInfo *ci);
 
 void collection_info_set_thumb(CollectInfo *ci, GdkPixbuf *pixbuf);
 
-void collection_list_free(GList *list);
-
 GList *collection_list_sort(GList *list, SortType method);
 GList *collection_list_add(GList *list, CollectInfo *ci, SortType method);
 GList *collection_list_insert(GList *list, CollectInfo *ci, CollectInfo *insert_ci, SortType method);