diff options
author | wm4 <wm4@nowhere> | 2016-08-31 17:09:10 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-08-31 22:16:19 +0200 |
commit | 7dde096d8a6d9e82cac82bec439fef47d078f352 (patch) | |
tree | 4b6656fb69f4ec62b114ebd3cab0c5e8470a9fbb /options/m_option.h | |
parent | e024906408c4d079e77b136de9b0562a93daadce (diff) | |
download | mpv-7dde096d8a6d9e82cac82bec439fef47d078f352.tar.bz2 mpv-7dde096d8a6d9e82cac82bec439fef47d078f352.tar.xz |
m_config: introduce and use OPT_ALIAS for some options
OPT_ALIAS redirects the options at a higher level, instead of
introducing "duplicate" options with different name but same backing
storage. This uses the OPT_REPLACED mechanisms - only the deprecation
warning had to be made conditional. Note that e.g. --no-video still
works, because the "--no-..." redirection and OPT_ALIAS are orthogonal.
The deprecated --sub -> --sub-file alias had to be dropped, because it
essentially conflicts with --no-sub. If anyone complains, this could
probably still be undone by letting m_config_find_negation_opt do a
special mapping for --no-sub. (Which would be dumb, but simple and
effective.)
Diffstat (limited to 'options/m_option.h')
-rw-r--r-- | options/m_option.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/options/m_option.h b/options/m_option.h index bf7ee5939d..c5385e4241 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -691,13 +691,20 @@ extern const char m_option_path_separator; .type = &m_option_type_subconfig, \ .priv = (void*)&subconf) -// If "--name" was removed, but "--newname" has the same semantics. +// Provide a another name for the option. +#define OPT_ALIAS(optname, newname) \ + {.name = optname, .type = &m_option_type_alias, .priv = newname, \ + .offset = -1} + +// If "--optname" was removed, but "--newname" has the same semantics. // It will be redirected, and a warning will be printed on first use. #define OPT_REPLACED(optname, newname) \ - {.name = optname, .type = &m_option_type_alias, .priv = newname, .offset = -1} + {.name = optname, .type = &m_option_type_alias, .priv = newname, \ + .deprecation_message = "", .offset = -1} -// "--name" doesn't exist, but inform the user about a replacement with msg. +// "--optname" doesn't exist, but inform the user about a replacement with msg. #define OPT_REMOVED(optname, msg) \ - {.name = optname, .type = &m_option_type_removed, .priv = msg, .offset = -1} + {.name = optname, .type = &m_option_type_removed, .priv = msg, \ + .deprecation_message = "", .offset = -1} #endif /* MPLAYER_M_OPTION_H */ |