options: remove always true m_obj_list::allow_unknown_entries

Ever instance of m_obj_list is a constant and for all of them, the field
is true. Just remove the field all together.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Emil Velikov 2021-10-03 18:31:37 +01:00 committed by Dudemanguy
parent b66120a75d
commit 37619c4cf5
5 changed files with 1 additions and 10 deletions

View File

@ -120,7 +120,6 @@ static bool get_desc(struct m_obj_desc *dst, int index)
static const struct m_obj_list ao_obj_list = {
.get_desc = get_desc,
.description = "audio outputs",
.allow_unknown_entries = true,
.allow_trailer = true,
.disallow_positional_parameters = true,
.use_global_options = true,

View File

@ -67,7 +67,6 @@ const struct m_obj_list af_obj_list = {
.get_desc = get_af_desc,
.description = "audio filters",
.allow_disable_entries = true,
.allow_unknown_entries = true,
.check_unknown_entry = check_af_lavfi,
.print_help_list = print_af_help_list,
.print_unknown_entry_help = print_af_lavfi_help,
@ -124,7 +123,6 @@ const struct m_obj_list vf_obj_list = {
.get_desc = get_vf_desc,
.description = "video filters",
.allow_disable_entries = true,
.allow_unknown_entries = true,
.check_unknown_entry = check_vf_lavfi,
.print_help_list = print_vf_help_list,
.print_unknown_entry_help = print_vf_lavfi_help,

View File

@ -3217,9 +3217,7 @@ static int parse_obj_settings(struct mp_log *log, struct bstr opt, int op,
} else {
char name[80];
snprintf(name, sizeof(name), "%.*s", BSTR_P(str));
if (!list->allow_unknown_entries ||
(list->check_unknown_entry && !list->check_unknown_entry(name)))
{
if (list->check_unknown_entry && !list->check_unknown_entry(name)) {
mp_err(log, "Option %.*s: %.*s doesn't exist.\n",
BSTR_P(opt), BSTR_P(str));
return M_OPT_INVALID;

View File

@ -145,9 +145,6 @@ struct m_obj_list {
const char *aliases[5][2];
// Allow a trailing ",", which adds an entry with name=""
bool allow_trailer;
// Allow unknown entries, for which a dummy entry is inserted, and whose
// options are skipped and ignored.
bool allow_unknown_entries;
// Callback to test whether an unknown entry should be allowed. (This can
// be useful if adding them as explicit entries is too much work.)
bool (*check_unknown_entry)(const char *name);

View File

@ -211,7 +211,6 @@ const struct m_obj_list vo_obj_list = {
{"opengl-cb", "libmpv"},
{0}
},
.allow_unknown_entries = true,
.allow_trailer = true,
.disallow_positional_parameters = true,
.use_global_options = true,