From 7dde096d8a6d9e82cac82bec439fef47d078f352 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 31 Aug 2016 17:09:10 +0200 Subject: 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.) --- options/m_option.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'options/m_option.h') 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 */ -- cgit v1.2.3