[virt-tools-list] [libosinfo v5 06/12] Remove now redundant code in InstallConfigParam

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Mon Nov 19 22:17:15 UTC 2012


On Mon, Nov 19, 2012 at 7:07 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> On Mon, Nov 19, 2012 at 06:01:14PM +0100, Michal Privoznik wrote:
>> On 14.11.2012 03:40, Zeeshan Ali (Khattak) wrote:
>> > From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>> >
>> > Remove private structure and finalize implementation. This should have
>> > been part of commit ee9e797.
>> > ---
>> >  osinfo/osinfo_install_config_param.c | 29 -----------------------------
>> >  1 file changed, 29 deletions(-)
>> >
>> > diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c
>> > index 8803073..399bdd4 100644
>> > --- a/osinfo/osinfo_install_config_param.c
>> > +++ b/osinfo/osinfo_install_config_param.c
>> > @@ -40,12 +40,6 @@ G_DEFINE_TYPE (OsinfoInstallConfigParam, osinfo_install_config_param, OSINFO_TYP
>> >   * generate an automated installation script
>> >   */
>> >
>> > -struct _OsinfoInstallConfigParamPrivate
>> > -{
>> > -    gchar *name;
>> > -    OsinfoInstallConfigParamPolicy policy;
>> > -};
>> > -
>> >  enum {
>> >      PROP_0,
>> >
>> > @@ -108,18 +102,6 @@ osinfo_install_config_param_get_property(GObject *object,
>> >      }
>> >  }
>> >
>> > -
>> > -static void
>> > -osinfo_install_config_param_finalize(GObject *object)
>> > -{
>> > -    OsinfoInstallConfigParam *config_param =
>> > -        OSINFO_INSTALL_CONFIG_PARAM(object);
>> > -    g_free(config_param->priv->name);
>> > -
>> > -    /* Chain up to the parent class */
>> > -    G_OBJECT_CLASS (osinfo_install_config_param_parent_class)->finalize (object);
>> > -}
>> > -
>> >  /* Init functions */
>> >  static void
>> >  osinfo_install_config_param_class_init (OsinfoInstallConfigParamClass *klass)
>> > @@ -165,24 +147,13 @@ osinfo_install_config_param_class_init (OsinfoInstallConfigParamClass *klass)
>> >      g_object_class_install_property(g_klass,
>> >                                      PROP_POLICY,
>> >                                      pspec);
>> > -
>> > -    g_klass->finalize = osinfo_install_config_param_finalize;
>> > -
>> > -    g_type_class_add_private (klass, sizeof (OsinfoInstallConfigParamPrivate));
>> >  }
>> >
>> >  static void
>> >  osinfo_install_config_param_init (OsinfoInstallConfigParam *config_param)
>> >  {
>> > -    OsinfoInstallConfigParamPrivate *priv;
>> > -    config_param->priv = priv =
>> > -        OSINFO_INSTALL_CONFIG_PARAM_GET_PRIVATE(config_param);
>> > -
>> > -    config_param->priv->name = NULL;
>> > -    config_param->priv->policy = OSINFO_INSTALL_CONFIG_PARAM_POLICY_NONE;
>> >  }
>>
>>
>> Well, first I wondered what is it good for having an empty void func
>> around. But then I tried to build without it and get an error message.
>> Diggin' more into it proved it's caused by G_DEFINE_TYPE() macro which
>> expands to calling it. Pity. Maybe we can add one line command, e.g.:
>>
>> /* this is needed because of G_DEFINE_TYPE() */
>>
>> ACK then.
>
> I guess I would have kept the empty 'priv' struct in case it's ever needed
> in the future, which would make _init non empty.

*If* we ever need it, its not so hard to add it (even from scratch) so
not worth keeping redundant code/allocations.

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124




More information about the virt-tools-list mailing list