]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix the config_options_test
authorMatthew Jordan <mjordan@digium.com>
Sun, 25 Aug 2013 18:00:46 +0000 (18:00 +0000)
committerMatthew Jordan <mjordan@digium.com>
Sun, 25 Aug 2013 18:00:46 +0000 (18:00 +0000)
The config options test requires the entire configuration item to be transparent from
the documentation system. So we let it do that too.

As an aside, please do not use this power for evil. Documentation is your friend, and
you really should document your configurations. Hiding your module's configuration
information from the system attempting to enforce some sanity in the universe is something
only a Bond villain would contemplate.
........

Merged revisions 397628 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397629 65c4cc65-6c06-0410-ace0-fbb531ad65f3

include/asterisk/config_options.h
main/config_options.c
tests/test_config.c

index 55e40ad8a901a2484f278fd2ffb8b669fb65dca1..11a8c5bf9feccc71ca719272d3f1c4e94a64b981 100644 (file)
@@ -156,6 +156,7 @@ struct aco_file {
 
 struct aco_info {
        const char *module; /*!< The name of the module whose config is being processed */
+       int hidden:1;                /*!< If enabled, this config item is hidden from users */
        aco_pre_apply_config pre_apply_config; /*!< A callback called after processing, but before changes are applied */
        aco_post_apply_config post_apply_config;/*!< A callback called after changes are applied */
        aco_snapshot_alloc snapshot_alloc;     /*!< Allocate an object to hold all global configs and item containers */
@@ -213,6 +214,15 @@ static struct aco_info name = { \
        __VA_ARGS__ \
 };
 
+#define CONFIG_INFO_TEST(name, arr, alloc, ...) \
+static struct aco_info name = { \
+       .module = AST_MODULE, \
+       .global_obj = &arr, \
+       .snapshot_alloc = alloc, \
+       .hidden = 1, \
+       __VA_ARGS__ \
+};
+
 /*! \brief Initialize an aco_info structure
  * \note aco_info_destroy must be called if this succeeds
  * \param info The address of an aco_info struct to initialize
index e789c1cfcf45efe925cbefb2c3df10dd7e976be0..0d869b9601a4b3830e35d3f9ffb880ade6b317a6 100644 (file)
@@ -184,7 +184,9 @@ static int link_option_to_types(struct aco_info *info, struct aco_type **types,
                }
                if (!ao2_link(type->internal->opts, opt)
 #ifdef AST_XML_DOCS
-                               || (!opt->no_doc && xmldoc_update_config_option(types, info->module, opt->name, type->name, opt->default_val, opt->match_type == ACO_REGEX, opt->type))
+                               || (!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 */
                ) {
                        do {
@@ -773,7 +775,9 @@ int aco_info_init(struct aco_info *info)
                                goto error;
                        }
 #ifdef AST_XML_DOCS
-                       if (!type->hidden && xmldoc_update_config_type(info->module, type->name, type->category, type->matchfield, type->matchvalue, type->category_match == ACO_WHITELIST)) {
+                       if (!info->hidden &&
+                               !type->hidden &&
+                               xmldoc_update_config_type(info->module, type->name, type->category, type->matchfield, type->matchvalue, type->category_match == ACO_WHITELIST)) {
                                goto error;
                        }
 #endif /* AST_XML_DOCS */
index 8eeb9f8a9bf34c57e53d6db4ef5c121a361e1b8b..6b1a8e420cdb375729a6f52df89a8f0475b0146f 100644 (file)
@@ -749,7 +749,7 @@ struct aco_file config_test_conf = {
 };
 
 static AO2_GLOBAL_OBJ_STATIC(global_obj);
-CONFIG_INFO_STANDARD(cfg_info, global_obj, test_config_alloc,
+CONFIG_INFO_TEST(cfg_info, global_obj, test_config_alloc,
        .files = ACO_FILES(&config_test_conf),
 );