[libvirt] [libvirt-glib 02/37] Use new helpers to simplify gvir_config_domain_set_features
Marc-André Lureau
marcandre.lureau at gmail.com
Fri Nov 11 14:29:32 UTC 2011
ack
On Thu, Nov 10, 2011 at 9:33 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> ---
> libvirt-gconfig/libvirt-gconfig-domain.c | 17 +++--------------
> 1 files changed, 3 insertions(+), 14 deletions(-)
>
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain.c b/libvirt-gconfig/libvirt-gconfig-domain.c
> index 3290389..c847c14 100644
> --- a/libvirt-gconfig/libvirt-gconfig-domain.c
> +++ b/libvirt-gconfig/libvirt-gconfig-domain.c
> @@ -223,27 +223,16 @@ GStrv gvir_config_domain_get_features(GVirConfigDomain *domain)
> void gvir_config_domain_set_features(GVirConfigDomain *domain,
> const GStrv features)
> {
> - xmlNodePtr parent_node;
> xmlNodePtr features_node;
> - xmlNodePtr old_node;
> GStrv it;
>
> - parent_node = gvir_config_object_get_xml_node(GVIR_CONFIG_OBJECT(domain));
> - features_node = xmlNewDocNode(parent_node->doc, NULL,
> - (xmlChar *)"features", NULL);
> + features_node = gvir_config_object_new_child(GVIR_CONFIG_OBJECT(domain),
> + "features");
> for (it = features; *it != NULL; it++) {
> xmlNodePtr node;
>
> - node = xmlNewDocNode(parent_node->doc, NULL, (xmlChar *)*it, NULL);
> + node = xmlNewDocNode(features_node->doc, NULL, (xmlChar *)*it, NULL);
> xmlAddChild(features_node, node);
> }
> -
> - old_node = gvir_config_xml_get_element(parent_node, "features", NULL);
> - if (old_node) {
> - old_node = xmlReplaceNode(old_node, features_node);
> - xmlFreeNode(old_node);
> - } else {
> - xmlAddChild(parent_node, features_node);
> - }
> g_object_notify(G_OBJECT(domain), "features");
> }
> --
> 1.7.7
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>
--
Marc-André Lureau
More information about the libvir-list
mailing list