[libvirt-glib 1/2] Add gvir_gconfig_object_remove_attribute helper

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

 



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

diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h
index ea06a67..38c129f 100644
--- a/libvirt-gconfig/libvirt-gconfig-object-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
@@ -64,6 +64,8 @@ void gvir_config_object_set_attribute(GVirConfigObject *object,
                                       ...) G_GNUC_NULL_TERMINATED;
 void gvir_config_object_set_attribute_with_type(GVirConfigObject *object,
                                                 ...) G_GNUC_NULL_TERMINATED;
+void gvir_config_object_remove_attribute(GVirConfigObject *object,
+                                         const char *attr_name);
 
 G_END_DECLS
 
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index a75db6e..52a2a0d 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -680,3 +680,14 @@ gvir_config_object_attach(GVirConfigObject *parent, GVirConfigObject *child)
         child->priv->doc = g_object_ref(G_OBJECT(parent->priv->doc));
     }
 }
+
+G_GNUC_INTERNAL void
+gvir_config_object_remove_attribute(GVirConfigObject *object,
+                                    const char *attr_name)
+{
+    int status;
+
+    do {
+        status = xmlUnsetProp(object->priv->node, (xmlChar *)attr_name);
+    } while (status == 0);
+}
-- 
1.7.7.4

--
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]