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

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



Hi

On Thu, Nov 10, 2011 at 9:33 PM, Christophe Fergeau <cfergeau redhat com> 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


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