From fb33e286b5c23dbe8d0aeaf63cd3490bed3906e3 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sat, 26 Apr 2008 10:44:59 +0300 Subject: Move global mconfig to mpctx The global was used in the function cfg_include which handles the -include option. Make the address available in that function by creating a new dynamically allocated option in m_config_new that has the address in the option's private data. asxparser.c also used the global. Making it available through all ways the code could get called required a number of relatively straightforward changes to playtree and menu code. --- m_config.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'm_config.c') diff --git a/m_config.c b/m_config.c index 02a2898dee..fc61494f0d 100644 --- a/m_config.c +++ b/m_config.c @@ -55,8 +55,9 @@ static void m_option_set(const m_config_t *config, const m_option_t *opt, -m_config_t* -m_config_new(void *optstruct) { +m_config_t *m_config_new(void *optstruct, + int includefunc(m_option_t *conf, char *filename)) +{ m_config_t* config; static int initialized = 0; static m_option_type_t profile_opt_type; @@ -80,6 +81,12 @@ m_config_new(void *optstruct) { for (i = 0; self_opts[i].name; i++) self_opts[i].priv = config; m_config_register_options(config, self_opts); + if (includefunc) { + struct m_option *p = talloc_ptrtype(config, p); + *p = (struct m_option){"include", includefunc, CONF_TYPE_FUNC_PARAM, + CONF_NOSAVE, 0, 0, config}; + m_config_add_option(config, p, NULL); + } config->optstruct = optstruct; return config; -- cgit v1.2.3