From a7ed3610ca8f688a1be7d003df157163eebbf615 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 11 Jun 2014 00:32:13 +0200 Subject: options: remove a global variable This is probably the last one, at least with my current configuration. --- options/m_config.h | 3 +++ options/parse_configfile.c | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'options') diff --git a/options/m_config.h b/options/m_config.h index e20a99853f..958dc3d5e4 100644 --- a/options/m_config.h +++ b/options/m_config.h @@ -67,6 +67,9 @@ typedef struct m_config { int (*includefunc)(void *ctx, char *filename, int flags); void *includefunc_ctx; + // For the command line parser + int recursion_depth; + void *optstruct; // struct mpopts or other } m_config_t; diff --git a/options/parse_configfile.c b/options/parse_configfile.c index a4ba67fd7e..1e12a5c47f 100644 --- a/options/parse_configfile.c +++ b/options/parse_configfile.c @@ -35,9 +35,6 @@ /// Maximal include depth. #define MAX_RECURSION_DEPTH 8 -/// Current include depth. -static int recursion_depth = 0; - // Load options and profiles from from a config file. // conffile: path to the config file // initial_section: default section where to add normal options @@ -68,7 +65,7 @@ int m_config_parse_config_file(m_config_t *config, const char *conffile, MP_VERBOSE(config, "Reading config file %s", conffile); - if (recursion_depth > MAX_RECURSION_DEPTH) { + if (config->recursion_depth > MAX_RECURSION_DEPTH) { MP_ERR(config, ": too deep 'include'. check your configfiles\n"); ret = -1; goto out; @@ -257,7 +254,7 @@ out: free(line); if (fp) fclose(fp); - --recursion_depth; + config->recursion_depth -= 1; if (ret < 0) { MP_FATAL(config, "Error loading config file %s.\n", conffile); -- cgit v1.2.3