[Libosinfo] [PATCHv4 08/11] Use OS-specific config in OsinfoInstallScript

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Tue Dec 18 14:45:15 UTC 2012


On Tue, Dec 18, 2012 at 12:05 PM, Christophe Fergeau
<cfergeau at redhat.com> wrote:
> On Tue, Dec 18, 2012 at 03:35:55AM +0200, Zeeshan Ali (Khattak) wrote:
>> On Mon, Dec 17, 2012 at 11:07 PM, Christophe Fergeau
>> <cfergeau at redhat.com> wrote:
>> > When generating the unattended installation script, we can now
>> > use osinfo_install_config_get_param_list() to get OS-specific
>> > values when available. This will only work when an
>> > OsinfoInstallConfigParamList is associated with the
>> > OsinfoInstallConfig being processed.
>> > ---
>> >  osinfo/osinfo_install_script.c | 15 +++++++++++++--
>> >  1 file changed, 13 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
>> > index d72c394..8dbef9e 100644
>> > --- a/osinfo/osinfo_install_script.c
>> > +++ b/osinfo/osinfo_install_script.c
>> > @@ -30,6 +30,7 @@
>> >  #include <libxslt/xsltutils.h>
>> >  #include <libxslt/xsltInternals.h>
>> >  #include <glib/gi18n-lib.h>
>> > +#include "osinfo_install_config_private.h"
>> >  #include "osinfo_install_script_private.h"
>> >
>> >  G_DEFINE_TYPE (OsinfoInstallScript, osinfo_install_script, OSINFO_TYPE_ENTITY);
>> > @@ -604,6 +605,7 @@ static xsltStylesheetPtr osinfo_install_script_load_template(const gchar *uri,
>> >
>> >  static xmlNodePtr osinfo_install_script_generate_entity_config(OsinfoInstallConfig *config,
>> >                                                                 OsinfoEntity *entity,
>> > +                                                               gboolean is_install_config,
>> >                                                                 const gchar *name,
>> >                                                                 GError **error)
>>
>> We don't need a boolean parameter for finding out the type of entity.
>> :) There is OSINFO_IS_INSTALL_CONFIG() or you can check if
>> name=="config".
>
> Yup, I've thought of both, we can also do if (config == entity) {}, but I
> preferred to go the explicit way since the caller knows what it wants us to
> do.

Caller knows what it is passing and callee has easy ways to find out
the type so why would you need this extra parameter? You are not
making anything more explicit either in the caller or callee
functions. Sorry but this just looks very clumsy.

-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124




More information about the Libosinfo mailing list