diff --git a/gio/tests/contenttype.c b/gio/tests/contenttype.c index db31ba136..ca5dfe8c0 100644 --- a/gio/tests/contenttype.c +++ b/gio/tests/contenttype.c @@ -75,8 +75,7 @@ test_list (void) g_assert (g_list_find_custom (types, plain, find_mime) != NULL); g_assert (g_list_find_custom (types, xml, find_mime) != NULL); - g_list_foreach (types, (GFunc)g_free, NULL); - g_list_free (types); + g_list_free_full (types, g_free); g_free (plain); g_free (xml); diff --git a/gio/tests/desktop-app-info.c b/gio/tests/desktop-app-info.c index 6c6e3135c..787d21725 100644 --- a/gio/tests/desktop-app-info.c +++ b/gio/tests/desktop-app-info.c @@ -120,8 +120,7 @@ test_default (void) info = (GAppInfo *)list->next->data; g_assert (g_strcmp0 (g_app_info_get_id (info), g_app_info_get_id (info1)) == 0); - g_list_foreach (list, (GFunc)g_object_unref, NULL); - g_list_free (list); + g_list_free_full (list, g_object_unref); /* now try adding something at the end */ g_app_info_add_supports_type (info3, "application/x-test", &error); @@ -140,8 +139,7 @@ test_default (void) info = (GAppInfo *)list->next->next->data; g_assert (g_strcmp0 (g_app_info_get_id (info), g_app_info_get_id (info3)) == 0); - g_list_foreach (list, (GFunc)g_object_unref, NULL); - g_list_free (list); + g_list_free_full (list, g_object_unref); /* now remove info1 again */ g_app_info_remove_supports_type (info1, "application/x-test", &error); @@ -157,8 +155,7 @@ test_default (void) info = (GAppInfo *)list->next->data; g_assert (g_strcmp0 (g_app_info_get_id (info), g_app_info_get_id (info3)) == 0); - g_list_foreach (list, (GFunc)g_object_unref, NULL); - g_list_free (list); + g_list_free_full (list, g_object_unref); /* now clean it all up */ g_app_info_reset_type_associations ("application/x-test"); diff --git a/gio/tests/gdbus-example-objectmanager-client.c b/gio/tests/gdbus-example-objectmanager-client.c index b413890d0..3d9242d7e 100644 --- a/gio/tests/gdbus-example-objectmanager-client.c +++ b/gio/tests/gdbus-example-objectmanager-client.c @@ -42,11 +42,9 @@ print_objects (GDBusObjectManager *manager) * can be used to get the value of the :Mood property. */ } - g_list_foreach (interfaces, (GFunc) g_object_unref, NULL); - g_list_free (interfaces); + g_list_free_full (interfaces, g_object_unref); } - g_list_foreach (objects, (GFunc) g_object_unref, NULL); - g_list_free (objects); + g_list_free_full (objects, g_object_unref); } static void diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c index 9ee0b08cb..ca1cf13fc 100644 --- a/gio/tests/gdbus-peer.c +++ b/gio/tests/gdbus-peer.c @@ -926,8 +926,7 @@ dmp_data_free (DmpData *data) g_main_loop_unref (data->loop); g_main_context_unref (data->context); g_object_unref (data->server); - g_list_foreach (data->connections, (GFunc) g_object_unref, NULL); - g_list_free (data->connections); + g_list_free_full (data->connections, g_object_unref); g_free (data); } diff --git a/gio/tests/gdbus-test-codegen.c b/gio/tests/gdbus-test-codegen.c index 3b4ac760a..0dfd37d29 100644 --- a/gio/tests/gdbus-test-codegen.c +++ b/gio/tests/gdbus-test-codegen.c @@ -2035,16 +2035,14 @@ check_object_manager (void) */ object_proxies = g_dbus_object_manager_get_objects (pm); g_assert (g_list_length (object_proxies) == 2); - g_list_foreach (object_proxies, (GFunc) g_object_unref, NULL); - g_list_free (object_proxies); + g_list_free_full (object_proxies, g_object_unref); op = g_dbus_object_manager_get_object (pm, "/managed/first"); g_assert (op != NULL); g_assert (FOO_IGEN_IS_OBJECT_PROXY (op)); g_assert_cmpstr (g_dbus_object_get_object_path (op), ==, "/managed/first"); proxies = g_dbus_object_get_interfaces (op); g_assert (g_list_length (proxies) == 1); - g_list_foreach (proxies, (GFunc) g_object_unref, NULL); - g_list_free (proxies); + g_list_free_full (proxies, g_object_unref); p = G_DBUS_PROXY (foo_igen_object_get_com_acme_coyote (FOO_IGEN_OBJECT (op))); g_assert (p != NULL); g_assert_cmpint (G_TYPE_FROM_INSTANCE (p), ==, FOO_IGEN_TYPE_COM_ACME_COYOTE_PROXY); @@ -2060,8 +2058,7 @@ check_object_manager (void) g_assert_cmpstr (g_dbus_object_get_object_path (op), ==, "/managed/second"); proxies = g_dbus_object_get_interfaces (op); g_assert (g_list_length (proxies) == 2); - g_list_foreach (proxies, (GFunc) g_object_unref, NULL); - g_list_free (proxies); + g_list_free_full (proxies, g_object_unref); p = G_DBUS_PROXY (foo_igen_object_get_bat (FOO_IGEN_OBJECT (op))); g_assert (p != NULL); g_assert_cmpint (G_TYPE_FROM_INSTANCE (p), ==, FOO_IGEN_TYPE_BAT_PROXY); diff --git a/gio/tests/volumemonitor.c b/gio/tests/volumemonitor.c index e3fdc3b03..489150524 100644 --- a/gio/tests/volumemonitor.c +++ b/gio/tests/volumemonitor.c @@ -91,8 +91,7 @@ do_drive_tests (GDrive *drive) do_volume_tests (drive, volume); } - g_list_foreach (volumes, (GFunc)g_object_unref, NULL); - g_list_free (volumes); + g_list_free_full (volumes, g_object_unref); } static void @@ -109,8 +108,7 @@ test_connected_drives (void) do_drive_tests (drive); } - g_list_foreach (drives, (GFunc)g_object_unref, NULL); - g_list_free (drives); + g_list_free_full (drives, g_object_unref); } static void @@ -131,8 +129,7 @@ test_volumes (void) g_object_unref (drive); } - g_list_foreach (volumes, (GFunc)g_object_unref, NULL); - g_list_free (volumes); + g_list_free_full (volumes, g_object_unref); } static void @@ -158,8 +155,7 @@ test_mounts (void) g_object_unref (volume); } - g_list_foreach (mounts, (GFunc)g_object_unref, NULL); - g_list_free (mounts); + g_list_free_full (mounts, g_object_unref); } int main (int argc, char *argv[])