summaryrefslogtreecommitdiffstats
path: root/options/m_option.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-11-29 15:18:40 +0100
committerwm4 <wm4@nowhere>2016-11-29 17:10:06 +0100
commit4958c1a556fa4f3bc4e4b3b36e04a056d90f69e1 (patch)
tree78c7f3bfc46dbf571685b69af324a6367a14b5aa /options/m_option.c
parent3203d6003c8e308b2ba4e277a64e717696b1b8b7 (diff)
downloadmpv-4958c1a556fa4f3bc4e4b3b36e04a056d90f69e1.tar.bz2
mpv-4958c1a556fa4f3bc4e4b3b36e04a056d90f69e1.tar.xz
options: some simplifications
Remove more stuff that was needed only for legacy suboptions. One user-visible change is that parent-options like --tv are now not visible anymore. They lead to a special error message when used before, but now they're simply not part of the option list anymore.
Diffstat (limited to 'options/m_option.c')
-rw-r--r--options/m_option.c58
1 files changed, 2 insertions, 56 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 6baa87c163..11bb677b97 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -1662,10 +1662,7 @@ const m_option_type_t m_option_type_print_fn = {
.parse = parse_print,
};
-
-/////////////////////// Subconfig
#undef VAL
-#define VAL(x) (*(char ***)(x))
// Read s sub-option name, or a positional sub-opt value.
// termset is a string containing the set of chars that terminate an option.
@@ -1750,50 +1747,6 @@ static int split_subconf(struct mp_log *log, bstr optname, bstr *str,
return 0;
}
-static int parse_subconf(struct mp_log *log, const m_option_t *opt,
- struct bstr name, struct bstr param, void *dst)
-{
- int nr = 0;
- char **lst = NULL;
-
- if (param.len == 0)
- return M_OPT_MISSING_PARAM;
-
- struct bstr p = param;
-
- while (p.len) {
- bstr subopt, subparam;
- int r = split_subconf(log, name, &p, &subopt, &subparam);
- if (r < 0)
- return r;
- if (bstr_startswith0(p, ":"))
- p = bstr_cut(p, 1);
- else if (p.len > 0) {
- mp_err(log, "Incorrect termination for '%.*s'\n", BSTR_P(subopt));
- return M_OPT_INVALID;
- }
-
- if (dst) {
- lst = talloc_realloc(NULL, lst, char *, 2 * (nr + 2));
- lst[2 * nr] = bstrto0(lst, subopt);
- lst[2 * nr + 1] = bstrto0(lst, subparam);
- memset(&lst[2 * (nr + 1)], 0, 2 * sizeof(char *));
- nr++;
- }
- }
-
- if (dst)
- VAL(dst) = lst;
-
- return 1;
-}
-
-const m_option_type_t m_option_type_subconfig = {
- .name = "Subconfig",
- .flags = M_OPT_TYPE_HAS_CHILD,
- .parse = parse_subconf,
-};
-
#undef VAL
// Split the string on the given split character.
@@ -3370,13 +3323,6 @@ const m_option_type_t m_option_type_alias = {
const m_option_type_t m_option_type_removed = {
.name = "removed",
};
-
-static int parse_dummy(struct mp_log *log, const m_option_t *opt,
- struct bstr name, struct bstr param, void *dst)
-{
- return 1;
-}
-const m_option_type_t m_option_type_subopt_legacy = {
- .name = "legacy suboption",
- .parse = parse_dummy,
+const m_option_type_t m_option_type_subconfig = {
+ .name = "Subconfig",
};