diff options
author | wm4 <wm4@nowhere> | 2018-02-13 03:16:29 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-02-13 17:45:29 -0800 |
commit | 223821d91c7ace8a4f7f726f1868bf2ae76b90ba (patch) | |
tree | 4083f216ae0b3cb6205ba3e73387345038a93fcc /options/m_option.c | |
parent | d7c38a0b23970569afe76f1c647c895506bfb65d (diff) | |
download | mpv-223821d91c7ace8a4f7f726f1868bf2ae76b90ba.tar.bz2 mpv-223821d91c7ace8a4f7f726f1868bf2ae76b90ba.tar.xz |
options: minor cleanup to --no-... handling
Most options starting with --no-<name> are automatically translated to
--<name>=no. Make the code slightly nicer by using a flag instead of
explicitly comparing option types. Also fix an issue that made the
option parser print nonsense error messages for if --no-... was used for
options which don't support it.
Diffstat (limited to 'options/m_option.c')
-rw-r--r-- | options/m_option.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/options/m_option.c b/options/m_option.c index e777c5a19e..4a32582873 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -183,11 +183,11 @@ const m_option_type_t m_option_type_flag = { // need yes or no in config files .name = "Flag", .size = sizeof(int), - .flags = M_OPT_TYPE_OPTIONAL_PARAM, + .flags = M_OPT_TYPE_OPTIONAL_PARAM | M_OPT_TYPE_CHOICE, .parse = parse_flag, .print = print_flag, .copy = copy_opt, - .add = add_flag, + .add = add_flag, .set = flag_set, .get = flag_get, }; @@ -747,6 +747,7 @@ static char *print_choice(const m_option_t *opt, const void *val) const struct m_option_type m_option_type_choice = { .name = "Choice", .size = sizeof(int), + .flags = M_OPT_TYPE_CHOICE, .parse = parse_choice, .print = print_choice, .copy = copy_opt, @@ -1087,6 +1088,7 @@ static int parse_float_aspect(struct mp_log *log, const m_option_t *opt, const m_option_type_t m_option_type_aspect = { .name = "Aspect", .size = sizeof(float), + .flags = M_OPT_TYPE_CHOICE, .parse = parse_float_aspect, .print = print_float, .pretty_print = print_float_f3, |