Re: [libvirt-glib 03/37] Add gobject boilerplate for GVirConfigClock and GVirConfigTimer

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

 



Hi

On Thu, Nov 10, 2011 at 9:33 PM, Christophe Fergeau <cfergeau@xxxxxxxxxx> wrote:
> +struct _GVirConfigClockPrivate
> +{
> +    gboolean unused;
> +};

(does it really matter if the struct is empty?)

> +G_DEFINE_TYPE(GVirConfigClock, gvir_config_clock, GVIR_TYPE_CONFIG_OBJECT);
> +
> +
> +static void gvir_config_clock_class_init(GVirConfigClockClass *klass)
> +{
> +
> +    g_type_class_add_private(klass, sizeof(GVirConfigClockPrivate));
> +}
> +
> +
> +static void gvir_config_clock_init(GVirConfigClock *klock)
> +{
> +    GVirConfigClockPrivate *priv;
> +
> +    DEBUG("Init GVirConfigClock=%p", klock);
> +
> +    priv = klock->priv = GVIR_CONFIG_CLOCK_GET_PRIVATE(klock);
> +
> +    memset(priv, 0, sizeof(*priv));

in fact, memset is useless here, GObject are always initialized with
0's including private data (from what I understand of gobject code). I
am going to send a patch to remove it on the whole code base.



> +struct _GVirConfigTimerPrivate
> +{
> +    gboolean unused;
> +};

> +    memset(priv, 0, sizeof(*priv));

same remarks here.

otherwise looks fine.

-- 
Marc-André Lureau

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