lib/param: Do not attempt to access the s3 function for allocated and subbed string...
authorAndrew Bartlett <abartlet@samba.org>
Mon, 14 Oct 2013 02:34:40 +0000 (15:34 +1300)
committerStefan Metzmacher <metze@samba.org>
Wed, 16 Oct 2013 07:29:02 +0000 (09:29 +0200)
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>
lib/param/loadparm.c

index 6d91891a1e98005deea798120262e6ddfcaf700b..71f62edf82824a14d4a4b0137fe56e2c4bab18a4 100644 (file)
@@ -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;                               \