[libvirt] [libvirt-glib 3/7] Add gvir_config_xml_node_to_string helper

Daniel P. Berrange berrange at redhat.com
Mon Feb 6 13:12:03 UTC 2012


On Mon, Feb 06, 2012 at 02:08:34PM +0100, Christophe Fergeau wrote:
> On Mon, Feb 06, 2012 at 12:02:23PM +0000, Daniel P. Berrange wrote:
> > In gvir_config_object_to_xml() we pass '1' for the 'format' argument
> > to get pretty-printed XML. Perhaps we should do the same here too ?
> 
> Sure, makes sense to be consistent.
> Actually, we could even go with this followup patch:
> 
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
> index a42b36c..662b8ed 100644
> --- a/libvirt-gconfig/libvirt-gconfig-object.c
> +++ b/libvirt-gconfig/libvirt-gconfig-object.c
> @@ -256,21 +256,7 @@ void gvir_config_object_validate(GVirConfigObject *config,
>  
>  gchar *gvir_config_object_to_xml(GVirConfigObject *config)
>  {
> -    xmlChar *doc;
> -    int size;
> -    xmlNodePtr node;
> -    gchar *output_doc;
> -
> -    node = gvir_config_object_get_xml_node(config);
> -    if (node == NULL)
> -        return NULL;
> -
> -    xmlDocDumpFormatMemory(node->doc, &doc, &size, 1);
> -
> -    output_doc = g_strdup((gchar *)doc);
> -    xmlFree(doc);
> -
> -    return output_doc;
> +    return gvir_config_xml_node_to_string(config->priv->node);
>  }
>  
>  const gchar *gvir_config_object_get_schema(GVirConfigObject *config)

ACK, looks good to me


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list