[hipl-dev] Re: [Branch ~toxedvirus/hipl/hipfw-modules] Rev 5008: Forward command line initialization to modules in order to allow registering command line options...

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-dev@xxxxxxxxxxxxx
  • Date: Thu, 04 Nov 2010 11:55:17 +0100

On Thu, Nov 04, 2010 at 11:51:02AM +0100, Andrius Bentkus wrote:
> On Thu, Nov 4, 2010 at 11:36 AM, Stefan Götz <stefan.goetz@xxxxxxxxxxxxxxxxx
> > wrote:
> 
> > > +void hip_cmd_init(struct hip_cmd_option_list *option_list,
> > > +                  const struct module_info *const modules,
> > > +                  const unsigned int size)
> > > +{
> > > +    unsigned int i;
> > > +    for (i = 0; i < size; i++) {
> > > +        if ((modules[i].cmd_function != NULL) && 
> > > !lmod_module_disabled(modules[i].name)) {
> > > +            modules[i].cmd_function(option_list);
> >
> > Diego seems to not like the '!= NULL' in checks so much...
> 
> How else am I supposed to check a function pointer?

Does the following not work?

  if ((modules[i].cmd_function != NULL) && 
!lmod_module_disabled(modules[i].name)) {

--->

  if (modules[i].cmd_function && !lmod_module_disabled(modules[i].name)) {

Diego

Other related posts: