From b9a3579ec980dfb01d0b952bf0b859ecdf62d7ea Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sat, 18 Dec 2010 08:02:48 +0200 Subject: commands: add generic option -> property wrapper Add mp_property_generic_option(), a property function that can be used for generic option-based properties that do not require any action beyond manipulating the value of the option variable. Currently it directly implements GET and SET, plus STEP_UP for "choice" options only. Use it to add a property for -pts-association-mode (not particularly useful in normal use, but serves as a test). --- m_config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'm_config.c') diff --git a/m_config.c b/m_config.c index 266ee10323..2752ced85f 100644 --- a/m_config.c +++ b/m_config.c @@ -150,7 +150,7 @@ static void m_option_save(const m_config_t *config, const m_option_t *opt, void *dst) { if (opt->type->save) { - const void *src = opt->new ? (char*)config->optstruct + opt->offset : opt->p; + const void *src = m_option_get_ptr(opt, config->optstruct); opt->type->save(opt, dst, src); } } @@ -159,7 +159,7 @@ static void m_option_set(const m_config_t *config, const m_option_t *opt, const void *src) { if (opt->type->set) { - void *dst = opt->new ? (char*)config->optstruct + opt->offset : opt->p; + void *dst = m_option_get_ptr(opt, config->optstruct); opt->type->set(opt, dst, src); } } -- cgit v1.2.3