[asterisk-commits] twilson: branch twilson/config_work r367030 - in /team/twilson/config_work: i...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 18 13:16:17 CDT 2012
Author: twilson
Date: Fri May 18 13:16:05 2012
New Revision: 367030
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=367030
Log:
Make aco_process_category_options and aco_set_defaults take an aco_info
This was a hold-over from before the aco_info struct existed. The options
container is private to the aco_info, so if these are to be public functions
they need to take an aco_info and not a container. I still think there could
be situations where it is useful to have these public, so I'm leaving them
here for now. I may revisit this decision.
Modified:
team/twilson/config_work/include/asterisk/config_options.h
team/twilson/config_work/main/config_options.c
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=367030&r1=367029&r2=367030
==============================================================================
--- team/twilson/config_work/include/asterisk/config_options.h (original)
+++ team/twilson/config_work/include/asterisk/config_options.h Fri May 18 13:16:05 2012
@@ -253,7 +253,7 @@
int aco_process_ast_config(struct aco_info *info, struct ast_config *cfg, int reload);
/*! \brief Parse each option defined in a config category
- * \param container The container of options from which to configure \a obj
+ * \param info The aco_info with the options for parsing
* \param cfg The ast_config being parsed
* \param cat The config category being parsed
* \param obj The user-defined config object that will store the parsed config items
@@ -261,17 +261,17 @@
* \retval 0 Success
* \retval -1 Failure
*/
-int aco_process_category_options(struct ao2_container *container, struct ast_config *cfg, const char *cat, void *obj);
+int aco_process_category_options(struct aco_info *info, struct ast_config *cfg, const char *cat, void *obj);
/*! \brief Set all default options of \a obj
- * \param container The container of options from which to apply defaults
+ * \param info The aco_info with the options
* \param category The configuration category from which \a obj is being configured
* \param obj The object being configured
*
* \retval 0 Success
* \retval -1 Failure
*/
-int aco_set_defaults(struct ao2_container *container, const char *category, void *obj);
+int aco_set_defaults(struct aco_info *info, const char *category, void *obj);
/*! \brief register a config option
*
Modified: team/twilson/config_work/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_work/main/config_options.c?view=diff&rev=367030&r1=367029&r2=367030
==============================================================================
--- team/twilson/config_work/main/config_options.c (original)
+++ team/twilson/config_work/main/config_options.c Fri May 18 13:16:05 2012
@@ -273,11 +273,11 @@
}
if (obj->type == ACO_GLOBAL && *field) {
- if (aco_set_defaults(info->internal->opts, cat, *field)) {
+ if (aco_set_defaults(info, cat, *field)) {
ast_log(LOG_ERROR, "In %s: Setting defaults for %s failed\n", info->filename, cat);
return -1;
}
- if (aco_process_category_options(info->internal->opts, cfg, cat, *field)) {
+ if (aco_process_category_options(info, cfg, cat, *field)) {
ast_log(LOG_ERROR, "In %s: Processing options for %s failed\n", info->filename, cat);
return -1;
}
@@ -295,7 +295,7 @@
return -1;
}
- if (aco_set_defaults(info->internal->opts, cat, new_item)) {
+ if (aco_set_defaults(info, cat, new_item)) {
ast_log(LOG_ERROR, "In %s: Setting defaults for %s failed\n", info->filename, cat);
return -1;
}
@@ -305,7 +305,7 @@
return -1;
}
- if (aco_process_category_options(info->internal->opts, cfg, cat, new_item)) {
+ if (aco_process_category_options(info, cfg, cat, new_item)) {
ast_log(LOG_ERROR, "In %s: Processing options for %s failed\n", info->filename, cat);
return -1;
}
@@ -399,12 +399,12 @@
return res;
}
-int aco_process_category_options(struct ao2_container *container, struct ast_config *cfg, const char *cat, void *obj)
+int aco_process_category_options(struct aco_info *info, struct ast_config *cfg, const char *cat, void *obj)
{
struct ast_variable *var;
for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
- RAII_VAR(struct aco_option *, opt, aco_option_find(container, var->name, cat), ao2_cleanup);
+ RAII_VAR(struct aco_option *, opt, aco_option_find(info->internal->opts, var->name, cat), ao2_cleanup);
if (!opt) {
ast_log(LOG_ERROR, "Could not find option suitable for category '%s' named '%s' at line %d of %s\n", cat, var->name, var->lineno, var->file);
return -1;
@@ -496,12 +496,12 @@
return !regexec(match->obj->regex, category, 0, NULL, 0) == !match->obj->category_match ? 0 : CMP_MATCH;
}
-int aco_set_defaults(struct ao2_container *container, const char *category, void *obj)
+int aco_set_defaults(struct aco_info *info, const char *category, void *obj)
{
RAII_VAR(struct ao2_iterator *, iter, NULL, ao2_iterator_cleanup);
struct aco_option *opt;
- if (!(iter = ao2_callback(container, OBJ_MULTIPLE, match_option_by_category, (void *) category))) {
+ if (!(iter = ao2_callback(info->internal->opts, OBJ_MULTIPLE, match_option_by_category, (void *) category))) {
return -1;
}
More information about the asterisk-commits
mailing list