[gobject-introspection: 1/4] regress: Use g_list_free_full and g_list_copy_deep
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection: 1/4] regress: Use g_list_free_full and g_list_copy_deep
- Date: Sat, 28 Jul 2018 01:13:33 +0000 (UTC)
commit ed8579029430cb64e107f5bbc846f44da5d3a2ec
Author: Simon Feltman <s feltman gmail com>
Date: Fri Dec 23 15:15:31 2016 -0800
regress: Use g_list_free_full and g_list_copy_deep
Cleanup which replaces manual loop implementation with API calls
when setting the linked list property.
https://bugzilla.gnome.org/show_bug.cgi?id=735013
Closes #113
tests/scanner/regress.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index e1da3d17..3ab85644 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -2135,15 +2135,9 @@ regress_test_obj_set_property (GObject *object,
case PROP_TEST_OBJ_LIST:
case PROP_TEST_OBJ_LIST_OLD:
- if (self->list != NULL)
- {
- for (list = self->list; list != NULL; list = g_list_next (list))
- g_free (list->data);
- g_list_free (self->list);
- }
- self->list = NULL;
- for (list = g_value_get_pointer (value); list != NULL; list = g_list_next (list))
- self->list = g_list_append (self->list, g_strdup (list->data));
+ g_list_free_full (self->list, g_free);
+ list = g_value_get_pointer (value);
+ self->list = g_list_copy_deep (list, (GCopyFunc) g_strdup, NULL);
break;
case PROP_TEST_OBJ_INT:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]