[libvirt-glib 2/4] Add gvir_config_object_delete_children

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

 



---
 libvirt-gconfig/libvirt-gconfig-object-private.h |    1 +
 libvirt-gconfig/libvirt-gconfig-object.c         |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h
index 6d01e26..922b0f3 100644
--- a/libvirt-gconfig/libvirt-gconfig-object-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
@@ -72,6 +72,7 @@ void gvir_config_object_replace_child_with_attribute(GVirConfigObject *object,
                                                      const char *attr_value);
 void gvir_config_object_delete_child(GVirConfigObject *object,
                                      const char *child_name);
+void gvir_config_object_delete_children(GVirConfigObject *object, const char *child_name);
 void gvir_config_object_set_child(GVirConfigObject *object,
                                   xmlNodePtr child);
 
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index 7fb8b69..dbb63a5 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -493,9 +493,22 @@ gvir_config_object_delete_child(GVirConfigObject *object,
                                      (gpointer)child_name);
 }
 
+static gboolean remove_always(xmlNodePtr node, gpointer opaque)
+{
+    maybe_unlink_node(node, opaque);
 
+    return TRUE;
 }
 
+G_GNUC_INTERNAL void
+gvir_config_object_delete_children(GVirConfigObject *object, const char *child_name)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_OBJECT(object));
+    g_return_if_fail(child_name != NULL);
+
+    gvir_config_object_foreach_child(object, NULL, remove_always,
+                                     (gpointer)child_name);
+}
 
 G_GNUC_INTERNAL void
 gvir_config_object_set_node_content(GVirConfigObject *object,
-- 
1.7.7.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]