diff options
author | Christoph Heinrich <christoph.heinrich@student.tugraz.at> | 2023-02-20 06:55:05 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-02-21 17:15:17 +0000 |
commit | 07545657bf73ebb4da38e26950d5203466298ec1 (patch) | |
tree | eae43d7de470693065c4f5d7e6c2f8e612838535 /options/m_option.c | |
parent | 17d91b9d4d2d208f4a847395198cdbbcad18de93 (diff) | |
download | mpv-07545657bf73ebb4da38e26950d5203466298ec1.tar.bz2 mpv-07545657bf73ebb4da38e26950d5203466298ec1.tar.xz |
options: remove OPT_FLAG
Diffstat (limited to 'options/m_option.c')
-rw-r--r-- | options/m_option.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/options/m_option.c b/options/m_option.c index 3c711132ea..61b75ec14a 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -224,70 +224,8 @@ const m_option_type_t m_option_type_bool = { #undef VAL -// Flag - -#define VAL(x) (*(int *)(x)) - -static int parse_flag(struct mp_log *log, const m_option_t *opt, - struct bstr name, struct bstr param, void *dst) -{ - bool bdst = false; - int r = parse_bool(log, opt, name, param, &bdst); - if (dst) - VAL(dst) = bdst; - return r; -} - -static char *print_flag(const m_option_t *opt, const void *val) -{ - return print_bool(opt, &(bool){VAL(val)}); -} - -static void add_flag(const m_option_t *opt, void *val, double add, bool wrap) -{ - bool bval = VAL(val); - add_bool(opt, &bval, add, wrap); - VAL(val) = bval; -} - -static int flag_set(const m_option_t *opt, void *dst, struct mpv_node *src) -{ - bool bdst = false; - int r = bool_set(opt, &bdst, src); - if (r >= 0) - VAL(dst) = bdst; - return r; -} - -static int flag_get(const m_option_t *opt, void *ta_parent, - struct mpv_node *dst, void *src) -{ - return bool_get(opt, ta_parent, dst, &(bool){VAL(src)}); -} - -static bool flag_equal(const m_option_t *opt, void *a, void *b) -{ - return VAL(a) == VAL(b); -} - -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 | M_OPT_TYPE_CHOICE, - .parse = parse_flag, - .print = print_flag, - .copy = copy_opt, - .add = add_flag, - .set = flag_set, - .get = flag_get, - .equal = flag_equal, -}; - // Integer -#undef VAL - static int clamp_longlong(const m_option_t *opt, long long i_min, long long i_max, void *val) { |