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

Re: [libvirt] [libvirt-glib 1/2] Add gvir_config_object_get_attribute_uint64()



On Tue, May 22, 2012 at 06:51:45PM +0300, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>
> 
> Another internal libvirt-gconfig helper to get unint64 XML attributes.

s/unint64/uint64, ACK with this small typo in the log fixed.

Christophe

> ---
>  libvirt-gconfig/libvirt-gconfig-object-private.h |    4 ++++
>  libvirt-gconfig/libvirt-gconfig-object.c         |   15 +++++++++++++++
>  2 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h
> index b3798c0..830517c 100644
> --- a/libvirt-gconfig/libvirt-gconfig-object-private.h
> +++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
> @@ -42,6 +42,10 @@ gint gvir_config_object_get_node_content_genum(GVirConfigObject *object,
>  const char *gvir_config_object_get_attribute(GVirConfigObject *object,
>                                               const char *node_name,
>                                               const char *attr_name);
> +guint64 gvir_config_object_get_attribute_uint64(GVirConfigObject *object,
> +                                                const char *node_name,
> +                                                const char *attr_name,
> +                                                guint64 default_value);
>  gint gvir_config_object_get_attribute_genum(GVirConfigObject *object,
>                                              const char *node_name,
>                                              const char *attr_name,
> diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
> index 1474393..a7352a5 100644
> --- a/libvirt-gconfig/libvirt-gconfig-object.c
> +++ b/libvirt-gconfig/libvirt-gconfig-object.c
> @@ -644,6 +644,21 @@ gvir_config_object_get_attribute_genum(GVirConfigObject *object,
>      return value;
>  }
>  
> +G_GNUC_INTERNAL guint64
> +gvir_config_object_get_attribute_uint64(GVirConfigObject *object,
> +                                        const char *node_name,
> +                                        const char *attr_name,
> +                                        guint64 default_value)
> +{
> +    const char *str;
> +
> +    str = gvir_config_object_get_attribute(object, node_name, attr_name);
> +    if (str == NULL)
> +        return default_value;
> +
> +    return g_ascii_strtoull(str, NULL, 0);
> +}
> +
>  GVirConfigObject *gvir_config_object_new_from_xml(GType type,
>                                                    const char *root_name,
>                                                    const char *schema,
> -- 
> 1.7.7.6
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpM9K2RcLhxB.pgp
Description: PGP signature


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