summaryrefslogtreecommitdiffstats
path: root/core/m_config.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-16 19:57:57 +0100
committerwm4 <wm4@nowhere>2013-02-16 19:57:57 +0100
commit57879a22004144bf9e20a97eea5ef3c1c1fbbfd9 (patch)
tree2ac31b3617dce60a1113ae107cac159e5cae9e92 /core/m_config.h
parente8181ed9fb9ea49e7def7a0a806b9d516a41168a (diff)
downloadmpv-57879a22004144bf9e20a97eea5ef3c1c1fbbfd9.tar.bz2
mpv-57879a22004144bf9e20a97eea5ef3c1c1fbbfd9.tar.xz
options: change handling of "no-" options yet again
Commit 4a40eed "options: change handling of "no-" options" generally improved the handling of automatically added negation options (recognizing "--no-opt", even though only "--opt" is declared in the option list). Unfortunately, one corner case was missed, which broke the option "--input=no-default-bindings" (other suboptions, e.g. VO suboptions, were not affected, and this is the only option where this mattered). Instead of increasing the complexity further, use a completely different approach: add the "--no-" options at runtime, and make them behave like real options. This approach could be considered slightly less elegant, because the code now has to worry about some option implementation details rather than leaving it to the parser, but all in all the new code is simpler and there are less weird corner cases to worry about.
Diffstat (limited to 'core/m_config.h')
-rw-r--r--core/m_config.h20
1 files changed, 6 insertions, 14 deletions
diff --git a/core/m_config.h b/core/m_config.h
index 57170cf48a..86376e4849 100644
--- a/core/m_config.h
+++ b/core/m_config.h
@@ -147,20 +147,12 @@ const struct m_option *m_config_get_option(const struct m_config *config,
struct m_config_option *m_config_get_co(const struct m_config *config,
struct bstr name);
-/* Map options like "no-opt=" to "opt=no".
- * config: config object.
- * name: option's name. May be set to a new name.
- * value: option value. May be set to a new value.
- * ambiguous: if true, "value" may be either an option value, or a separate,
- * unrelated option following the current option.
- * returns the following error codes:
- * < 0: one of the M_OPT_ error codes
- * 0: the option is valid, *value is set implicitly
- * ("--foo bar" maps to "--foo=yes" + "bar", *value == "yes")
- * 1: the option is valid, *value is a proper parameter
- */
-int m_config_map_option(struct m_config *config, bstr *name, bstr *value,
- bool ambiguous);
+// Return a hint to the option parser whether a parameter is/may be required.
+// The option may still accept empty/non-empty parameters independent from
+// this, and this function is useful only for handling ambiguous options like
+// flags (e.g. "--a" is ok, "--a=yes" is also ok).
+// Returns: error code (<0), or number of expected params (0, 1)
+int m_config_option_requires_param(struct m_config *config, bstr name);
/* Print a list of all registered options.
* \param config The config object.