mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-26 04:02:09 +01:00
tests: Use g_ptr_array_set_free_func() rather than manual free()
We don’t need to free array elements manually. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
121b6bc599
commit
bc0fcddc18
@ -964,6 +964,7 @@ pointer_array_copy (void)
|
|||||||
|
|
||||||
/* Test copy through GCopyFunc */
|
/* Test copy through GCopyFunc */
|
||||||
ptr_array2 = g_ptr_array_copy (ptr_array, ptr_array_copy_func, NULL);
|
ptr_array2 = g_ptr_array_copy (ptr_array, ptr_array_copy_func, NULL);
|
||||||
|
g_ptr_array_set_free_func (ptr_array2, g_free);
|
||||||
|
|
||||||
g_assert_cmpuint (ptr_array2->len, ==, ptr_array->len);
|
g_assert_cmpuint (ptr_array2->len, ==, ptr_array->len);
|
||||||
for (i = 0; i < array_size; i++)
|
for (i = 0; i < array_size; i++)
|
||||||
@ -973,9 +974,6 @@ pointer_array_copy (void)
|
|||||||
g_assert_cmpuint ((gsize) g_ptr_array_index (ptr_array, i), !=,
|
g_assert_cmpuint ((gsize) g_ptr_array_index (ptr_array, i), !=,
|
||||||
(gsize) g_ptr_array_index (ptr_array2, i));
|
(gsize) g_ptr_array_index (ptr_array2, i));
|
||||||
|
|
||||||
for (i = 0; i < array_size; i++)
|
|
||||||
free(ptr_array2->pdata[i]);
|
|
||||||
|
|
||||||
g_ptr_array_free (ptr_array2, TRUE);
|
g_ptr_array_free (ptr_array2, TRUE);
|
||||||
|
|
||||||
/* Final cleanup */
|
/* Final cleanup */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user