[asterisk-commits] twilson: branch twilson/config_work r366130 - in /team/twilson/config_work: a...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu May 10 14:19:27 CDT 2012
Author: twilson
Date: Thu May 10 14:19:23 2012
New Revision: 366130
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=366130
Log:
Make types be the dynamic-length array
Also makes CONFIG_INFO_STANDARD take the required filename and global object
array as pre-defined arguments.
Modified:
team/twilson/config_work/apps/app_skel.c
team/twilson/config_work/include/asterisk/config_options.h
team/twilson/config_work/main/udptl.c
Modified: team/twilson/config_work/apps/app_skel.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_work/apps/app_skel.c?view=diff&rev=366130&r1=366129&r2=366130
==============================================================================
--- team/twilson/config_work/apps/app_skel.c (original)
+++ team/twilson/config_work/apps/app_skel.c Thu May 10 14:19:23 2012
@@ -169,12 +169,8 @@
.find_pvt = skel_find_pvt,
};
-struct aco_type *types[] = { &general_options, &private_options, NULL };
-
-CONFIG_INFO_STANDARD(cfg_info,
- .filename = "app_skel.conf",
- .current_array = &global_config.global,
- .types = types,
+CONFIG_INFO_STANDARD(cfg_info, "app_skel.conf", global_config,
+ .types = { &general_options, &private_options, NULL },
);
static void skel_global_config_destructor(void *obj)
Modified: team/twilson/config_work/include/asterisk/config_options.h
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_work/include/asterisk/config_options.h?view=diff&rev=366130&r1=366129&r2=366130
==============================================================================
--- team/twilson/config_work/include/asterisk/config_options.h (original)
+++ team/twilson/config_work/include/asterisk/config_options.h Thu May 10 14:19:23 2012
@@ -135,14 +135,14 @@
typedef int (*aco_pre_apply_config)(void);
struct aco_info {
- const char *module;
- const char *filename;
- struct ao2_container *opts;
- struct aco_type **types;
- aco_pre_apply_config pre_apply_config;
- struct ao2_global_obj *current_array;
- void **new_array;
- const char *preload[]; /* Use a sentinel! Even if preload is empty! */
+ const char *module; /*!< The name of the module whose config is being processed */
+ const char *filename; /*!< The config filename */
+ struct ao2_container *opts; /*!< Internal use - options to parse */
+ aco_pre_apply_config pre_apply_config; /*!< A callback called after processing, but before changes are applied */
+ struct ao2_global_obj *current_array; /*!< The module's global object array for this config */
+ void **new_array; /*!< Internal use - A cache of new config objects to be applied */
+ const char **preload; /*!< Categories to parse first. Do something like char *arr[] = {"general", NULL}; and do .preload = arr */
+ struct aco_type *types[]; /*!< The list of types for this config. Required. Use a sentinel! */
};
/*! \def CONFIG_INFO_STANDARD
@@ -150,8 +150,7 @@
* \param name The name of the struct
* Example:
* \code
- * CONFIG_INFO_STANDARD(cfg_info,
- * .filename = "app_skel.conf",
+ * CONFIG_INFO_STANDARD(cfg_info, "app_skel.conf",
* .pre_apply_config = skel_pre_apply_config,
* );
* ...
@@ -162,10 +161,11 @@
* aco_info_destroy(&cfg_info);
* \endcode
*/
-#define CONFIG_INFO_STANDARD(name, ...) \
+#define CONFIG_INFO_STANDARD(name, fn, arr, ...) \
static struct aco_info name = { \
.module = AST_MODULE, \
- .preload = { SENTINEL, }, \
+ .filename = fn, \
+ .current_array = &arr.global, \
__VA_ARGS__ \
};
Modified: team/twilson/config_work/main/udptl.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_work/main/udptl.c?view=diff&rev=366130&r1=366129&r2=366130
==============================================================================
--- team/twilson/config_work/main/udptl.c (original)
+++ team/twilson/config_work/main/udptl.c Thu May 10 14:19:23 2012
@@ -206,13 +206,9 @@
.cfg_alloc = udptl_cfg_alloc,
};
-static struct aco_type *types[] = { &general_options, NULL };
-
-CONFIG_INFO_STANDARD(cfg_info,
- .filename = "udptl.conf",
+CONFIG_INFO_STANDARD(cfg_info, "udptl.conf", globals,
+ .types = { &general_options, NULL },
.pre_apply_config = udptl_pre_apply_config,
- .current_array = &globals.global,
- .types = types,
);
static inline int udptl_debug_test_addr(const struct ast_sockaddr *addr)
More information about the asterisk-commits
mailing list