summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-11 00:32:13 +0200
committerwm4 <wm4@nowhere>2014-06-11 00:39:14 +0200
commita7ed3610ca8f688a1be7d003df157163eebbf615 (patch)
treed2191d39965dea8967611c5b43d647f6d08f9495
parente34e1080d26b843554137c4340ae4d550aa3db6a (diff)
downloadmpv-a7ed3610ca8f688a1be7d003df157163eebbf615.tar.bz2
mpv-a7ed3610ca8f688a1be7d003df157163eebbf615.tar.xz
options: remove a global variable
This is probably the last one, at least with my current configuration.
-rw-r--r--options/m_config.h3
-rw-r--r--options/parse_configfile.c7
2 files changed, 5 insertions, 5 deletions
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);