From ef1f0e9ffe76eaee4b92241ea39d81ea553fa841 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 15 Oct 2019 16:52:30 +0200 Subject: param: add FN_{GLOBAL,LOCAL}_SUBSTITUTED_STRING support Pair-Programmed-With: Ralph Boehme Signed-off-by: Stefan Metzmacher Signed-off-by: Ralph Boehme --- lib/param/loadparm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/param/loadparm.c') diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 759a0a8ca45..25cf4eb7785 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -167,6 +167,15 @@ static struct loadparm_context *global_loadparm_context; return lp_ctx->globals->var_name ? talloc_strdup(ctx, lpcfg_string(lp_ctx->globals->var_name)) : talloc_strdup(ctx, ""); \ } +#define FN_GLOBAL_SUBSTITUTED_STRING(fn_name,var_name) \ + _PUBLIC_ char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx, \ + const struct loadparm_substitution *lp_sub, TALLOC_CTX *mem_ctx) \ +{ \ + if (lp_ctx == NULL) return NULL; \ + return lpcfg_substituted_string(mem_ctx, lp_sub, \ + lp_ctx->globals->var_name ? 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; \ @@ -199,6 +208,9 @@ static struct loadparm_context *global_loadparm_context; return(talloc_strdup(ctx, lpcfg_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val)))); \ } +/* just a copy for now */ +#define FN_LOCAL_SUBSTITUTED_STRING(fn_name,val) FN_LOCAL_STRING(fn_name,val) + #define FN_LOCAL_CONST_STRING(fn_name,val) \ _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_service *service, \ struct loadparm_service *sDefault) { \ -- cgit v1.2.1