diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-10-14 15:34:40 +1300 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2013-10-16 09:29:02 +0200 |
commit | d711a011448718e055ffa2af3470f0d961234cd3 (patch) | |
tree | ad32b6855dc694d2a9759dfed515032dbd760754 /lib | |
parent | 6ac33b7f2ec574af356e5286831952519026246e (diff) | |
download | samba-d711a011448718e055ffa2af3470f0d961234cd3.tar.gz samba-d711a011448718e055ffa2af3470f0d961234cd3.tar.bz2 samba-d711a011448718e055ffa2af3470f0d961234cd3.zip |
lib/param: Do not attempt to access the s3 function for allocated and subbed string parameters
This allows us not to generate array entries for these, which in turn allows
us to avoid initialising them. The issue is that we do not have the
% macro sub context nor a talloc context handy (yet).
Andrew Bartlett
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/param/loadparm.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 6d91891a1e..71f62edf82 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -232,7 +232,16 @@ static struct loadparm_context *global_loadparm_context; #define lpcfg_default_service global_loadparm_context->sDefault #define lpcfg_global_service(i) global_loadparm_context->services[i] -#define FN_GLOBAL_STRING(fn_name,var_name) \ +#define FN_GLOBAL_STRING(fn_name,var_name) \ + _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) {\ + if (lp_ctx == NULL) return NULL; \ + if (lp_ctx->s3_fns) { \ + smb_panic( __location__ ": " #fn_name " not implemented because it is an allocated and substiuted string"); \ + } \ + return lp_ctx->globals->var_name ? lp_string(lp_ctx->globals->var_name) : ""; \ +} + +#define FN_GLOBAL_CONST_STRING(fn_name,var_name) \ _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \ if (lp_ctx == NULL) return NULL; \ if (lp_ctx->s3_fns) { \ @@ -242,16 +251,6 @@ static struct loadparm_context *global_loadparm_context; return lp_ctx->globals->var_name ? lp_string(lp_ctx->globals->var_name) : ""; \ } -#define FN_GLOBAL_CONST_STRING(fn_name,var_name) \ - _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) {\ - if (lp_ctx == NULL) return NULL; \ - if (lp_ctx->s3_fns) { \ - SMB_ASSERT(lp_ctx->s3_fns->fn_name); \ - return lp_ctx->s3_fns->fn_name(); \ - } \ - return lp_ctx->globals->var_name ? lp_string(lp_ctx->globals->var_name) : ""; \ - } - #define FN_GLOBAL_LIST(fn_name,var_name) \ _PUBLIC_ const char **lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \ if (lp_ctx == NULL) return NULL; \ |