summaryrefslogtreecommitdiffstats
path: root/options/m_config.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-01-16 11:35:37 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-01-18 00:59:07 -0800
commit1d3b680427a4a08d8e3df212eef74751fa56694e (patch)
treef61438a04528fb973e239c8354293e5f79097c16 /options/m_config.h
parentcc3cdcb0f065eb0166acc664bb3c743c4bcd246b (diff)
downloadmpv-1d3b680427a4a08d8e3df212eef74751fa56694e.tar.bz2
mpv-1d3b680427a4a08d8e3df212eef74751fa56694e.tar.xz
options: simplify mp_get_config_group() memory management
There is some craziness here: the function allocates m_config_cache, which in turn allocates the actual option struct, which is what the function returns. The user would expect to be able to use talloc_free() to deallocate everything. Of course this didn't work, because the returned pointer is not the root parent in the talloc tree. But with some additional talloc craziness, this can be fixed. We rearrange the parent pointers such that freeing the option struct will free m_config_cache first, which uninits the contents in the option struct, but fortunately not the option struct itself. This change should simplify API use on the caller side, and reduce surprises.
Diffstat (limited to 'options/m_config.h')
-rw-r--r--options/m_config.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/options/m_config.h b/options/m_config.h
index 80aeaef789..79f17b9bbe 100644
--- a/options/m_config.h
+++ b/options/m_config.h
@@ -325,8 +325,6 @@ bool m_config_cache_update(struct m_config_cache *cache);
// Like m_config_cache_alloc(), but return the struct (m_config_cache->opts)
// directly, with no way to update the config. Basically this returns a copy
// with a snapshot of the current option values.
-// Warning: does currently not set the child as its own talloc root, which
-// means the only way to free the struct is by freeing ta_parent.
void *mp_get_config_group(void *ta_parent, struct mpv_global *global,
const struct m_sub_options *group);