mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 19:36:18 +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 */
|
||||
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);
|
||||
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), !=,
|
||||
(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);
|
||||
|
||||
/* Final cleanup */
|
||||
|
Loading…
Reference in New Issue
Block a user