[libvirt] [libvirt-glib 1/4] config: Allow NULL node name to gvir_config_object_set_content
Daniel P. Berrange
berrange at redhat.com
Mon Sep 10 10:09:01 UTC 2012
On Mon, Sep 10, 2012 at 10:58:55AM +0200, Christophe Fergeau wrote:
> Hey,
>
> I think this patch was missed during the review, I can't push the 3 patches
> that were ACK'ed without this one.
>
> Christophe
>
> On Tue, Sep 04, 2012 at 02:44:45PM +0200, Christophe Fergeau wrote:
> > This is useful when you want to set the content of the current node.
> > ---
> > libvirt-gconfig/libvirt-gconfig-object.c | 10 ++++++----
> > 1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
> > index a7352a5..ac0545c 100644
> > --- a/libvirt-gconfig/libvirt-gconfig-object.c
> > +++ b/libvirt-gconfig/libvirt-gconfig-object.c
> > @@ -534,7 +534,6 @@ gvir_config_object_set_node_content(GVirConfigObject *object,
> > GVirConfigObject *node;
> >
> > g_return_if_fail(GVIR_CONFIG_IS_OBJECT(object));
> > - g_return_if_fail(node_name != NULL);
> >
> > if (value == NULL) {
> > gvir_config_object_delete_child(object, node_name, NULL);
> > @@ -542,8 +541,12 @@ gvir_config_object_set_node_content(GVirConfigObject *object,
> > return;
> > }
> >
> > - node = gvir_config_object_replace_child(object, node_name);
> > - g_return_if_fail(node != NULL);
> > + if (node_name != NULL) {
> > + node = gvir_config_object_replace_child(object, node_name);
> > + g_return_if_fail(node != NULL);
> > + } else {
> > + node = g_object_ref(G_OBJECT(object));
> > + }
> > encoded_data = xmlEncodeEntitiesReentrant(node->priv->node->doc,
> > (xmlChar *)value);
> > xmlNodeSetContent(node->priv->node, encoded_data);
> > @@ -559,7 +562,6 @@ gvir_config_object_set_node_content_uint64(GVirConfigObject *object,
> > char *str;
> >
> > g_return_if_fail(GVIR_CONFIG_IS_OBJECT(object));
> > - g_return_if_fail(node_name != NULL);
> >
> > str = g_strdup_printf("%"G_GUINT64_FORMAT, value);
> > gvir_config_object_set_node_content(object, node_name, str);
> > --
> > 1.7.11.4
> >
> > --
> > libvir-list mailing list
> > libvir-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list
ACK
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