options: remove a global variable

This is probably the last one, at least with my current configuration.
This commit is contained in:
wm4 2014-06-11 00:32:13 +02:00
parent e34e1080d2
commit a7ed3610ca
2 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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);