From 37c03f2c81a443e910eeb3b2613865dce59c54bf Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 4 Aug 2012 11:14:38 +0200 Subject: options: revert passing around talloc contexts This reverts commit 48f0692ab9 "options: make option struct the talloc parent of options". This made things actually more complicated. It introduced a new parameter to the option parse and copy functions, which was used inconsistently. Some code passed a parent, some not. Morever, you have to call m_option_free() anyway, because not all options actually respect the talloc parent. There is also the question whether passing NULL as parent is supposed to work, or if you still have to implement m_config_free(). On the other hand, this simplifies nothing. I assume the intention was being able to free all option values with a single talloc_free() call, but the same goal can be reached by simply freeing the m_config struct. (The m_config talloc destructor will free each option values.) Get rid of the talloc parent context parameter. This essentially reverts commit 48f0692ab9 ("options: make option struct the talloc parent of options"). In video_out.c, make the VO priv struct the talloc parent for the m_config object, so that destroying the VO will free the options. The ability to free the m_config struct and all its managed options was introduced in commit 89a17bcda6c. --- libvo/video_out.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libvo/video_out.c') diff --git a/libvo/video_out.c b/libvo/video_out.c index a17fc9aa28..0466ec5fad 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -176,11 +176,11 @@ static int vo_preinit(struct vo *vo, char *arg) vo->priv = talloc_zero_size(vo, vo->driver->privsize); if (vo->driver->options) { struct m_config *cfg = m_config_simple(vo->driver->options, vo->priv); + talloc_steal(vo->priv, cfg); char n[50]; int l = snprintf(n, sizeof(n), "vo/%s", vo->driver->info->short_name); assert(l < sizeof(n)); int r = m_config_parse_suboptions(cfg, n, arg); - talloc_free(cfg); if (r < 0) return r; } -- cgit v1.2.3