modules: BOOL vs. int

Stefan (metze) Metzmacher metze at metzemix.de
Thu Mar 27 13:29:11 GMT 2003


At 12:12 27.03.2003 +0100, Jelmer Vernooij wrote:
> > I noticed that all smb_register_*() fn's return BOOL
> > and the init_module() fn's returns int
> > so this is wrong:
>I don't have problems with this. We only need the return value in
>smb_probe_module() to check for failure, and False is defined to be
>equal to 0. The current way is more flexible. Some functions return a
>BOOL, but others return an int (such as in rpc).

You're right but I think its confusing

can't we name the return var
BOOL when we use True or False
or!!!
int when we use 0 or -1

because int 0 means often success and BOOL False (int 0) means failure
(this is confusing and cries for bugs!!!)

And just for a better coding style :-)

And I want it to be equal for all smb_register_*() fn's
> > int auth_sam_init(void)
> > {
> >         smb_register_auth("samstrict_dc", auth_init_samstrict_dc,
> > AUTH_INTERFACE_VERSION);
> >         smb_register_auth("samstrict", auth_init_samstrict,
> > AUTH_INTERFACE_VERSION);
> >         smb_register_auth("sam", auth_init_sam, AUTH_INTERFACE_VERSION);
> >         return True;
> > }
>When would you want the function to fail ? If registering one of the
>functions fails?

ok don't fail but a warning would be good



metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de> 



More information about the samba-technical mailing list