diff options
author | Mark Michelson <mmichelson@digium.com> | 2016-01-28 15:56:30 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-01-28 15:56:30 -0600 |
commit | 51547175c0a456465930a31f66273ed997d5add2 (patch) | |
tree | f3cd03e9736de2ca247b30b103bf38096cbdc647 /main/config_options.c | |
parent | d2397f028fd4b92a96ad2232ba73400ca9afafb0 (diff) | |
parent | 1dfd104a276459bf5c7ad07c4f9615b4b8c5e2d4 (diff) |
Merge "config: Allow options to register when documentation is unavailable."
Diffstat (limited to 'main/config_options.c')
-rw-r--r-- | main/config_options.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/main/config_options.c b/main/config_options.c index f7f181b89..f8c7b0c67 100644 --- a/main/config_options.c +++ b/main/config_options.c @@ -71,6 +71,9 @@ struct aco_option { aco_option_handler handler; unsigned int flags; unsigned int no_doc:1; +#ifdef AST_DEVMODE + unsigned int doc_unavailable:1; +#endif unsigned char deprecated:1; size_t argc; intptr_t args[0]; @@ -183,18 +186,20 @@ static int link_option_to_types(struct aco_info *info, struct aco_type **types, ast_log(LOG_ERROR, "Attempting to register option using uninitialized type\n"); return -1; } - if (!ao2_link(type->internal->opts, opt) -#ifdef AST_XML_DOCS - || (!info->hidden && - !opt->no_doc && - xmldoc_update_config_option(types, info->module, opt->name, type->name, opt->default_val, opt->match_type == ACO_REGEX, opt->type)) -#endif /* AST_XML_DOCS */ - ) { + if (!ao2_link(type->internal->opts, opt)) { do { ao2_unlink(types[idx - 1]->internal->opts, opt); } while (--idx); return -1; } +#ifdef AST_XML_DOCS + if (!info->hidden && !opt->no_doc && + xmldoc_update_config_option(types, info->module, opt->name, type->name, opt->default_val, opt->match_type == ACO_REGEX, opt->type)) { +#ifdef AST_DEVMODE + opt->doc_unavailable = 1; +#endif +#endif + } } /* The container(s) should hold the only ref to opt */ ao2_ref(opt, -1); @@ -716,6 +721,14 @@ int aco_process_var(struct aco_type *type, const char *cat, struct ast_variable ast_log(LOG_ERROR, "BUG! Somehow a config option for %s/%s was created with no handler!\n", cat, var->name); return -1; } + +#ifdef AST_DEVMODE + if (opt->doc_unavailable) { + ast_log(LOG_ERROR, "Config option '%s' of type '%s' is not completely documented and can not be set\n", var->name, type->name); + return -1; + } +#endif + if (opt->handler(opt, var, obj)) { ast_log(LOG_ERROR, "Error parsing %s=%s at line %d of %s\n", var->name, var->value, var->lineno, var->file); return -1; |