modules: BOOL vs. int

Jelmer Vernooij jelmer at samba.org
Thu Mar 27 11:12:17 GMT 2003


On Thu, Mar 27, 2003 at 08:23:43AM +0100, Stefan (metze) Metzmacher wrote about 'modules: BOOL vs. int':
> Hi Jelmer,

> 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). 

> int pdb_xml_init(void)
> {
>         return smb_register_passdb("xml", xmlsam_init, 
> PASSDB_INTERFACE_VERSION);
> }

> and here we really should check the return values,
> and print out warnings or fail when the registration didn' success.

> 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?

jelmer

-- 
Jelmer Vernooij <jelmer at nl.linux.org> - http://nl.linux.org/~jelmer/
 12:05:12 up 19:53, 10 users,  load average: 0.31, 0.33, 0.30
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20030327/a4d0f469/attachment.bin


More information about the samba-technical mailing list