From d711a011448718e055ffa2af3470f0d961234cd3 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Oct 2013 15:34:40 +1300 Subject: [PATCH] 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 Reviewed-by: Stefan Metzmacher --- lib/param/loadparm.c | 21 ++++++++++----------- 1 file 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; \ -- 2.34.1