diff options
author | wm4 <wm4@nowhere> | 2020-03-12 14:10:37 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-03-13 16:50:27 +0100 |
commit | d3ad4e23088da95697ab2ec385267c06293c4515 (patch) | |
tree | d7b323780133d01cc93bec60e51700337f8bda67 /options/m_option.c | |
parent | 3006c4ba5dd119160bdcf1d650c66197a44de602 (diff) | |
download | mpv-d3ad4e23088da95697ab2ec385267c06293c4515.tar.bz2 mpv-d3ad4e23088da95697ab2ec385267c06293c4515.tar.xz |
options: remove intpair option type
This was mostly unused, and has certain problems. Just get rid of it.
It was still used in CDDA (--cdda-span) and a debug option for OpenGL
(--opengl-check-pattern). Replace both of these with 2 options, where
each sets the start/end values of the former span. Both were
undocumented somehow (normally we require all options to be documented),
so I'm not caring about compatibility, and not bothering to add it to
the API changelog.
Diffstat (limited to 'options/m_option.c')
-rw-r--r-- | options/m_option.c | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/options/m_option.c b/options/m_option.c index 3f01663fa9..c07601c0bf 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -502,59 +502,6 @@ const m_option_type_t m_option_type_byte_size = { .equal = int64_equal, }; -static int parse_intpair(struct mp_log *log, const struct m_option *opt, - struct bstr name, struct bstr param, void *dst) -{ - if (param.len == 0) - return M_OPT_MISSING_PARAM; - - struct bstr s = param; - int end = -1; - int start = bstrtoll(s, &s, 10); - if (s.len == param.len) - goto bad; - if (s.len > 0) { - if (!bstr_startswith0(s, "-")) - goto bad; - s = bstr_cut(s, 1); - } - if (s.len > 0) - end = bstrtoll(s, &s, 10); - if (s.len > 0) - goto bad; - - if (dst) { - int *p = dst; - p[0] = start; - p[1] = end; - } - - return 1; - -bad: - mp_err(log, "Invalid integer range " - "specification for option %.*s: %.*s\n", - BSTR_P(name), BSTR_P(param)); - return M_OPT_INVALID; -} - -static char *print_intpair(const m_option_t *opt, const void *val) -{ - const int *p = val; - char *res = talloc_asprintf(NULL, "%d", p[0]); - if (p[1] != -1) - res = talloc_asprintf_append(res, "-%d", p[1]); - return res; -} - -const struct m_option_type m_option_type_intpair = { - .name = "Int[-Int]", - .size = sizeof(int[2]), - .parse = parse_intpair, - .print = print_intpair, - .copy = copy_opt, -}; - const char *m_opt_choice_str(const struct m_opt_choice_alternatives *choices, int value) { |