Re: [libvirt-glib 1/4] config: Allow NULL node name to gvir_config_object_set_content

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

 



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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpiy76AjWxfL.pgp
Description: PGP signature

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