summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-07-13 01:22:37 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commit8ffd1073a2aa07b51dfb6fe8b0e4b1658e1c01f1 (patch)
tree9f8f02e1f54d205e3d0a40b187ca2e62d256404c
parentcd3394f0398956961e93465d3665df827ef5aaef (diff)
downloadmpv-8ffd1073a2aa07b51dfb6fe8b0e4b1658e1c01f1.tar.bz2
mpv-8ffd1073a2aa07b51dfb6fe8b0e4b1658e1c01f1.tar.xz
m_config: remove m_config_create_shadow
A previous commit changed m_config so that it always creates the shadow thing, and the function's only remaining purpose was to initialize mpv_global. It makes much more sense to do that at the caller, and it's only 1 line of code too.
-rw-r--r--options/m_config.c8
-rw-r--r--options/m_config.h4
-rw-r--r--player/main.c2
3 files changed, 1 insertions, 13 deletions
diff --git a/options/m_config.c b/options/m_config.c
index c9b7272235..4eda265eba 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -1234,14 +1234,6 @@ struct mpv_node m_config_get_profiles(struct m_config *config)
return root;
}
-void m_config_create_shadow(struct m_config *config)
-{
- assert(config->global);
- assert(!config->global->config);
-
- config->global->config = config->shadow;
-}
-
static void cache_destroy(void *p)
{
struct m_config_cache *cache = p;
diff --git a/options/m_config.h b/options/m_config.h
index 207870e12a..c843aa01f0 100644
--- a/options/m_config.h
+++ b/options/m_config.h
@@ -107,10 +107,6 @@ struct m_config *m_config_new(void *talloc_ctx, struct mp_log *log,
size_t size, const void *defaults,
const struct m_option *options);
-// Creates "backup" shadow memory for use with m_config_cache. Sets it on
-// mpv_global. Expected to be called at early init on the main m_config.
-void m_config_create_shadow(struct m_config *config);
-
// Create a m_config for the given desc. This is for --af/--vf, which have
// different sub-options for every filter (represented by separate desc
// structs).
diff --git a/player/main.c b/player/main.c
index e1f3285984..04acf3cc72 100644
--- a/player/main.c
+++ b/player/main.c
@@ -296,13 +296,13 @@ struct MPContext *mp_create(void)
mpctx->mconfig = m_config_new(mpctx, mpctx->log, sizeof(struct MPOpts),
&mp_default_opts, mp_opts);
mpctx->opts = mpctx->mconfig->optstruct;
+ mpctx->global->config = mpctx->mconfig->shadow;
mpctx->mconfig->includefunc = cfg_include;
mpctx->mconfig->includefunc_ctx = mpctx;
mpctx->mconfig->use_profiles = true;
mpctx->mconfig->is_toplevel = true;
mpctx->mconfig->global = mpctx->global;
m_config_parse(mpctx->mconfig, "", bstr0(def_config), NULL, 0);
- m_config_create_shadow(mpctx->mconfig);
mpctx->input = mp_input_init(mpctx->global, mp_wakeup_core_cb, mpctx);
screenshot_init(mpctx);