diff options
author | wm4 <wm4@nowhere> | 2013-10-24 20:05:27 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-10-24 22:50:13 +0200 |
commit | b707589e7e9dffed7176641d43521aae9144d669 (patch) | |
tree | da4e7525ae7bdfa88e124640402cabe23b139090 | |
parent | 4cd143e4d81f062ee89cdd4f8121157044e7238c (diff) | |
download | mpv-b707589e7e9dffed7176641d43521aae9144d669.tar.bz2 mpv-b707589e7e9dffed7176641d43521aae9144d669.tar.xz |
m_config: minor simplification
I think in this case, having a separate function is confusing.
-rw-r--r-- | mpvcore/m_config.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/mpvcore/m_config.c b/mpvcore/m_config.c index 6a1284393c..17e886bbe0 100644 --- a/mpvcore/m_config.c +++ b/mpvcore/m_config.c @@ -361,12 +361,6 @@ static void add_options(struct m_config *config, m_config_add_option(config, parent, parent_name, &defs[i]); } -// Sub-config that adds all its children to the parent. -static bool is_merge_opt(const struct m_option *opt) -{ - return (opt->type->flags & M_OPT_TYPE_HAS_CHILD) && strlen(opt->name) == 0; -} - static void m_config_add_option(struct m_config *config, struct m_config_option *parent, const char *parent_name, @@ -375,6 +369,11 @@ static void m_config_add_option(struct m_config *config, assert(config != NULL); assert(arg != NULL); + // True if arg is a sub-config that adds all its children to the parent. + // arg itself doesn't really exist, then (other than allocating sub-config). + bool is_merge_opt = + (arg->type->flags & M_OPT_TYPE_HAS_CHILD) && !arg->name[0]; + // Allocate a new entry for this option struct m_config_option co = { .opt = arg, @@ -393,7 +392,7 @@ static void m_config_add_option(struct m_config *config, // Option with children -> add them if (arg->type->flags & M_OPT_TYPE_HAS_CHILD) { // Merge case: pretend it has no parent - const char *new_parent_name = is_merge_opt(arg) ? parent_name : co.name; + const char *new_parent_name = is_merge_opt ? parent_name : co.name; if (arg->type->flags & M_OPT_TYPE_USE_SUBSTRUCT) { const struct m_sub_options *subopts = arg->priv; @@ -431,8 +430,7 @@ static void m_config_add_option(struct m_config *config, } } - // pretend that merge options don't exist (only their children matter) - if (!is_merge_opt(co.opt)) + if (!is_merge_opt) MP_TARRAY_APPEND(config, config->opts, config->num_opts, co); add_negation_option(config, &co, parent_name); |