svn commit: samba r9798 - in branches/SAMBA_4_0/source: include
lib lib/samba3 param scripting/ejs
Stefan (metze) Metzmacher
metze at samba.org
Wed Aug 31 06:53:54 GMT 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
jelmer at samba.org schrieb:
> Author: jelmer
> Date: 2005-08-30 13:58:48 +0000 (Tue, 30 Aug 2005)
> New Revision: 9798
>
> WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9798
>
> Log:
> Add generic functions for handling smb.conf files (the parameters don't to be pre-declared). Also doesn't use any globals, so multiple files can be loaded at once.
>
> Currently uses the prefix "param" for all functions and structures; suggestions for better ones are welcome...
Hi Jelmer,
that patch looks really nice.
would it be possible to check the success of talloc calls?
I think we should not segfault when it fails!
here's an example:
+ section = param_get_section(ctx, section_name);
+
+ if (section == NULL) {
+ section = talloc_zero(ctx, struct param_section);
+ section->name = talloc_strdup(section, section_name);
+ DLIST_ADD(ctx->sections, section);
+ }
+
+ p = param_section_get(section, name);
+ if (p == NULL) {
+ p = talloc_zero(section, struct param);
+ p->name = talloc_strdup(p, name);
+ DLIST_ADD(section->parameters, p);
+ }
if one of the talloc_zero calls fails we'll crash!
We should also make use of talloc_get_type() in some places:
+static BOOL param_sfunc (const char *name, void *_ctx)
+{
+ struct param_context *ctx = _ctx;
here for example.
- --
metze
Stefan Metzmacher <metze at samba.org> www.samba.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3-nr1 (Windows XP)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDFVQBm70gjA5TCD8RAgbkAJ4vdUk1KRj87nPbKSQMCQjchKdCGQCgwD2U
kTsrbQgIkUgqrJc540JYaZ0=
=LklL
-----END PGP SIGNATURE-----
More information about the samba-cvs
mailing list