loadparm: Add ctx member to struct loadparm_global.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 23 Jul 2012 02:49:46 +0000 (12:19 +0930)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 7 Aug 2012 13:20:04 +0000 (23:20 +1000)
Rather than tallocing global parameters off NULL, keep it neat by having
a Global.ctx member.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
script/mkparamdefs.pl
source3/param/loadparm.c

index b489cc9277a40d1c7901563bb91ae55e3ee58a2a..6b59230b243cdc50afac1d554befceb6043f12ab 100644 (file)
@@ -91,12 +91,14 @@ $file->("/* This file was automatically generated by mkparamdefs.pl. DO NOT EDIT
            $file->(" * This structure describes global (ie., server-wide) parameters.\n");
            $file->(" */\n");
            $file->("struct loadparm_global \n");
+           $file->("{\n");
+           $file->("\tTALLOC_CTX *ctx; /* Context for talloced members */\n");
        } elsif ($generate_scope eq "LOCAL") {
            $file->(" * This structure describes a single service.\n");
            $file->(" */\n");
            $file->("struct loadparm_service \n");
+           $file->("{\n");
        }
-$file->("{\n");
 }
 
 sub print_footer($$$)
index 1b766c3c468d7049c7dee601bf9eb0e8f47609b2..1cbac61fcc0a66743d0a9561a11bb89415e9bc48 100644 (file)
@@ -593,6 +593,7 @@ static void free_global_parameters(void)
 {
        free_param_opts(&Globals.param_opt);
        free_parameters_by_snum(GLOBAL_SECTION_SNUM);
+       TALLOC_FREE(Globals.ctx);
 }
 
 static int map_parameter(const char *pszParmName);
@@ -690,6 +691,8 @@ static void init_globals(bool reinit_globals)
         * table once the defaults are set */
        ZERO_STRUCT(Globals);
 
+       Globals.ctx = talloc_new(NULL);
+
        for (i = 0; parm_table[i].label; i++) {
                if ((parm_table[i].type == P_STRING ||
                     parm_table[i].type == P_USTRING))