[PATCH] parametric options
Andrew Bartlett
abartlet at samba.org
Tue Dec 31 22:04:02 GMT 2002
On Wed, 2003-01-01 at 02:44, Stefan (metze) Metzmacher wrote:
> Hi *,
>
> here are the parametric option changes of my big patch...
>
> all lp_param_*() functions now take the default value as last parameter
> this is usefull for all fn's and needed for the enum,bool,int and ulong
> functions :-)
Is this the best way to do it - if we are going to have a notion of
defaults, then doing it per-call is just waiting for disaster! Given
that we are moving to a 'registration' style of module system (where we
know at startup what modules we have), I think we really should move
'parametric options' to a registrations system too. Indeed, this would
allow the implement ion of callback syntax checking, which could make
testparm useful again.
> lp_parm_string_list() now use talloc_str_list_make() and
> talloc_realloc_str_list_make and caches the the result for the called
> seperator, so if the function is called with the same separator it is not
> needed to call *_str_list_make()
>
> if the function is called with an other separator the old list is free'ed
>
> so we didn't get a memory leek if we call:
>
> lp_parm_string_list(SNUM(conn), "test","name"," \n\r\t", NULL);
> lp_parm_string_list(SNUM(conn), "test","name",";,.", NULL);
> lp_parm_string_list(SNUM(conn), "test","name"," \n\r\t", NULL);
> lp_parm_string_list(SNUM(conn), "test","name",";,.", NULL);
> lp_parm_string_list(SNUM(conn), "test","name"," \n\r\t", NULL);
Why do we allow the separator to be changed at all? The 'normal'
options in Samba don't all this - I really don't see the need for the
added complexity. Furthermore, how are you going to tell SWAT etc about
this - it should display lists as lists, and not depend on function
parameters to get it right. I just don't like the idea that a list
could change depending on a parameter somebody will always get slightly
wrong.
> talloc_realloc_str_list_make()
>
> a add talloc_free() witch free's the memory of one talloc'ed memory segment
This doesn't seem right - why not just free and replace that talloc
context?
> a also add a view talloc_realloc_*() functions
>
> talloc_realloc_strdup() ...
Why?
Andrew Bartlett
--
Andrew Bartlett abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team abartlet at samba.org
Student Network Administrator, Hawker College abartlet at hawkerc.net
http://samba.org http://build.samba.org http://hawkerc.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20021231/7ffa8ef0/attachment.bin
More information about the samba-technical
mailing list