diff m_option.c @ 34169:9b617726812c

Sanitize include behaviour. The normal func_param argument type will iterate over all previous values each time a new value is assigned. This leads e.g. to a complete mess and non-working recursion limiting when creating a config file that includes itself. Seem to also fix bug #1994.
author reimar
date Tue, 25 Oct 2011 20:18:35 +0000
parents ab178e06077e
children a05c274e1409
line wrap: on
line diff
--- a/m_option.c	Tue Oct 25 19:22:10 2011 +0000
+++ b/m_option.c	Tue Oct 25 20:18:35 2011 +0000
@@ -715,6 +715,25 @@
 
 ///////////////////  Func based options
 
+static int parse_call_func(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
+  ((m_opt_func_param_t) opt->p)(opt,param);
+}
+
+// special variant, will not have a history/be able to
+// be used as per-file option etc.
+const m_option_type_t m_option_type_func_param_immediate = {
+  "Func param once",
+  "",
+  0,
+  M_OPT_TYPE_INDIRECT,
+  parse_call_func,
+  NULL,
+  NULL, // Nothing to do on save
+  NULL,
+  NULL,
+  NULL
+};
+
 // A chained list to save the various calls for func_param and func_full
 typedef struct m_func_save m_func_save_t;
 struct m_func_save {