gio/tests: Use g_list_free_full() convenience function

This commit is contained in:
Javier Jardón 2012-01-02 15:20:42 +01:00
parent 411259ddd3
commit ee044fd839
6 changed files with 14 additions and 28 deletions

View File

@ -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);

View File

@ -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");

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View File

@ -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[])