From 37619c4cf590f866bfb5fe517ef4daefb36c9193 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 3 Oct 2021 18:31:37 +0100 Subject: [PATCH] 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 --- audio/out/ao.c | 1 - filters/user_filters.c | 2 -- options/m_option.c | 4 +--- options/m_option.h | 3 --- video/out/vo.c | 1 - 5 files changed, 1 insertion(+), 10 deletions(-) diff --git a/audio/out/ao.c b/audio/out/ao.c index 7c347cb138..532b5bb4e2 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -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, diff --git a/filters/user_filters.c b/filters/user_filters.c index ae8da64d7d..34382ba052 100644 --- a/filters/user_filters.c +++ b/filters/user_filters.c @@ -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, diff --git a/options/m_option.c b/options/m_option.c index f5a9ce5573..9c9101f2e7 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -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; diff --git a/options/m_option.h b/options/m_option.h index 322f120a06..435f11f912 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -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); diff --git a/video/out/vo.c b/video/out/vo.c index 80fcaad4d0..08d109b768 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -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,