[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [designer PATCH 4/6] Use g_list_free_full



Use g_list_free_full instead of g_list_foreach + g_list_free, so the
lists are cleared with a single call.  This also avoids
cast-function-type warnings because of the different signature of GFunc
and g_object_unref.

Signed-off-by: Pino Toscano <ptoscano redhat com>
---
 libvirt-designer/libvirt-designer-domain.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/libvirt-designer/libvirt-designer-domain.c b/libvirt-designer/libvirt-designer-domain.c
index cd9349f..9ca6832 100644
--- a/libvirt-designer/libvirt-designer-domain.c
+++ b/libvirt-designer/libvirt-designer-domain.c
@@ -993,8 +993,7 @@ gvir_designer_domain_get_guest(GVirDesignerDomain *design,
         tmp = tmp->next;
     }
 
-    g_list_foreach(guests, (GFunc)g_object_unref, NULL);
-    g_list_free(guests);
+    g_list_free_full(guests, g_object_unref);
     return ret;
 }
 
@@ -1031,8 +1030,7 @@ gvir_designer_domain_get_guest_full(GVirDesignerDomain *design,
     }
 
 cleanup:
-    g_list_foreach(guests, (GFunc)g_object_unref, NULL);
-    g_list_free(guests);
+    g_list_free_full(guests, g_object_unref);
     return ret;
 }
 
@@ -1150,8 +1148,7 @@ gvir_designer_domain_best_guest_domain(GVirConfigCapabilitiesGuestArch *arch,
                 gvir_config_capabilities_guest_arch_get_name(arch));
 
 cleanup:
-    g_list_foreach(domains, (GFunc)g_object_unref, NULL);
-    g_list_free(domains);
+    g_list_free_full(domains, g_object_unref);
     return ret;
 }
 
-- 
2.17.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]