[asterisk-commits] twilson: branch twilson/config_work r366239 - in /team/twilson/config_work: a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 10 18:21:16 CDT 2012


Author: twilson
Date: Thu May 10 18:21:12 2012
New Revision: 366239

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=366239
Log:
Commit some minor renaming before the storm


Modified:
    team/twilson/config_work/apps/app_skel.c
    team/twilson/config_work/include/asterisk/config_options.h
    team/twilson/config_work/main/config_options.c
    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=366239&r1=366238&r2=366239
==============================================================================
--- team/twilson/config_work/apps/app_skel.c (original)
+++ team/twilson/config_work/apps/app_skel.c Thu May 10 18:21:12 2012
@@ -141,24 +141,22 @@
 
 #define PVT_BUCKETS 17
 
-static AO2_GLOBAL_OBJ_STATIC(global_config, NUM_GLOBAL_OBJECTS);
+static void *skel_global_alloc(const char *cat);
 static void *skel_pvt_cfg_alloc(const char *cat);
 static int skel_containers_alloc(struct ao2_container **newpvts, struct ao2_container **newcfgs);
 static void *skel_find_or_create_pvt(const char *category);
 static void *skel_find_pvt(struct ao2_container *tmp_container, const char *category);
 
-static void *skel_global_alloc(const char *cat);
-
 static struct aco_type general_options = {
-	.type = GLOBAL_OBJ,
+	.type = ACO_GLOBAL_OBJ,
 	.global_index = GLOBAL_OPTIONS,
 	.category_allow = ACO_WHITELIST,
 	.category = "general",
-	.cfg_alloc = (aco_type_alloc) skel_global_alloc,
+	.cfg_alloc = skel_global_alloc,
 };
 
 static struct aco_type private_options = {
-	.type = PRIVATE_OBJ,
+	.type = ACO_PRIVATE_OBJ,
 	.pvt_index = PVT_CONTAINER,
 	.cfg_index = PVT_CFG_CONTAINER,
 	.category_allow = ACO_BLACKLIST,
@@ -169,7 +167,9 @@
 	.find_pvt = skel_find_pvt,
 };
 
-CONFIG_INFO_STANDARD(cfg_info, "app_skel.conf", global_config,
+static AO2_GLOBAL_OBJ_STATIC(globals, NUM_GLOBAL_OBJECTS);
+
+CONFIG_INFO_STANDARD(cfg_info, "app_skel.conf", globals,
 	.types = { &general_options, &private_options, NULL },
 );
 
@@ -181,7 +181,7 @@
 
 static void skel_pvt_cfg_unlink(struct skel_pvt_config *cfg)
 {
-	RAII_VAR(struct ao2_container *, cfgs, ao2_global_obj_ref(global_config, PVT_CFG_CONTAINER), ao2_cleanup);
+	RAII_VAR(struct ao2_container *, cfgs, ao2_global_obj_ref(globals, PVT_CFG_CONTAINER), ao2_cleanup);
 	if (cfgs) {
 		ao2_unlink(cfgs, cfg);
 	}
@@ -189,7 +189,7 @@
 
 static struct skel_pvt_config *skel_pvt_find_cfg(struct skel_pvt *pvt)
 {
-	RAII_VAR(struct ao2_container *, cfgs, ao2_global_obj_ref(global_config, PVT_CFG_CONTAINER), ao2_cleanup);
+	RAII_VAR(struct ao2_container *, cfgs, ao2_global_obj_ref(globals, PVT_CFG_CONTAINER), ao2_cleanup);
 	if (cfgs) {
 		return ao2_find(cfgs, pvt->name, OBJ_KEY);
 	}
@@ -341,7 +341,7 @@
 
 static void *skel_find_or_create_pvt(const char *category)
 {
-	RAII_VAR(struct ao2_container *, pvt_container, ao2_global_obj_ref(global_config, PVT_CONTAINER), ao2_cleanup);
+	RAII_VAR(struct ao2_container *, pvt_container, ao2_global_obj_ref(globals, PVT_CONTAINER), ao2_cleanup);
 	void *obj;
 	if (!pvt_container || !(obj = ao2_find(pvt_container, category, OBJ_KEY))) {
 		return skel_pvt_alloc(category);
@@ -408,7 +408,7 @@
 		return NULL;
 	}
 
-	if (!(cfg = ao2_global_obj_ref(global_config, GLOBAL_OPTIONS))) {
+	if (!(cfg = ao2_global_obj_ref(globals, GLOBAL_OPTIONS))) {
 		return NULL;
 	}
 
@@ -440,10 +440,10 @@
 		return NULL;
 	}
 
-	if (!(pvts = ao2_global_obj_ref(global_config, PVT_CONTAINER))) {
-		return NULL;
-	}
-	if (!(cfgs = ao2_global_obj_ref(global_config, PVT_CFG_CONTAINER))) {
+	if (!(pvts = ao2_global_obj_ref(globals, PVT_CONTAINER))) {
+		return NULL;
+	}
+	if (!(cfgs = ao2_global_obj_ref(globals, PVT_CFG_CONTAINER))) {
 		ao2_ref(pvts, -1);
 		return NULL;
 	}
@@ -490,7 +490,7 @@
 {
 	ast_cli_unregister_multiple(skel_cli, ARRAY_LEN(skel_cli));
 	aco_info_destroy(&cfg_info);
-	ao2_global_obj_release(global_config);
+	ao2_global_obj_release(globals);
 	return ast_unregister_application(app);
 }
 

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=366239&r1=366238&r2=366239
==============================================================================
--- team/twilson/config_work/include/asterisk/config_options.h (original)
+++ team/twilson/config_work/include/asterisk/config_options.h Thu May 10 18:21:12 2012
@@ -37,8 +37,8 @@
 struct aco_type;
 
 enum aco_type_t {
-	GLOBAL_OBJ,
-	PRIVATE_OBJ,
+	ACO_GLOBAL_OBJ,
+	ACO_PRIVATE_OBJ,
 };
 
 /*! \brief Whether a category regex is a blackist or a whitelist */
@@ -150,7 +150,8 @@
  * \param name The name of the struct
  * Example:
  * \code
- * CONFIG_INFO_STANDARD(cfg_info, "app_skel.conf",
+ * static AO2_GLOBAL_OBJ_STATIC(globals, NUM_GLOBALS);
+ * CONFIG_INFO_STANDARD(cfg_info, "app_skel.conf", globals,
  *     .pre_apply_config = skel_pre_apply_config,
  * );
  * ...

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=366239&r1=366238&r2=366239
==============================================================================
--- team/twilson/config_work/main/config_options.c (original)
+++ team/twilson/config_work/main/config_options.c Thu May 10 18:21:12 2012
@@ -187,12 +187,12 @@
 
 	for (x = 0, t = info->types[x]; t; t = info->types[++x]) {
 		switch (t->type) {
-		case GLOBAL_OBJ:
+		case ACO_GLOBAL_OBJ:
 			if (!(info->new_array[t->global_index] = t->cfg_alloc(NULL))) {
 				return -1;
 			}
 			break;
-		case PRIVATE_OBJ:
+		case ACO_PRIVATE_OBJ:
 			if (t->containers_alloc((struct ao2_container **) &info->new_array[t->pvt_index], (struct ao2_container **) &info->new_array[t->cfg_index])) {
 				return -1;
 			}
@@ -209,13 +209,13 @@
 
 	for (x = 0, t = info->types[x]; t; t = info->types[++x]) {
 		switch (t->type) {
-		case GLOBAL_OBJ:
+		case ACO_GLOBAL_OBJ:
 			if (info->new_array[t->global_index]) {
 				ao2_ref(info->new_array[t->global_index], -1);
 				info->new_array[t->global_index] = NULL;
 			}
 			break;
-		case PRIVATE_OBJ:
+		case ACO_PRIVATE_OBJ:
 			if (info->new_array[t->pvt_index]) {
 				ao2_ref(info->new_array[t->pvt_index], -1);
 				info->new_array[t->pvt_index] = NULL;
@@ -291,7 +291,7 @@
 	}
 
 	/* if type == GLOBAL_OBJ, set defaults and configure the cached cfg object */
-	if (obj->type == GLOBAL_OBJ && info->new_array[obj->global_index]) {
+	if (obj->type == ACO_GLOBAL_OBJ && info->new_array[obj->global_index]) {
 		if (aco_set_defaults(info->opts, cat, info->new_array[obj->global_index])) {
 			ast_log(LOG_ERROR, "In %s: Setting defaults for %s failed\n", info->filename, cat);
 			return -1;
@@ -300,7 +300,7 @@
 			ast_log(LOG_ERROR, "In %s: Processing options for %s failed\n", info->filename, cat);
 			return -1;
 		}
-	} else if (obj->type == PRIVATE_OBJ) {
+	} else if (obj->type == ACO_PRIVATE_OBJ) {
 		/* If we've already linked a private for cat in newpvts, don't add a second one with the same name */
 		if (info->new_array[obj->pvt_index]) {
 			if ((tmppvt = obj->find_pvt(info->new_array[obj->pvt_index], cat))) {

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=366239&r1=366238&r2=366239
==============================================================================
--- team/twilson/config_work/main/udptl.c (original)
+++ team/twilson/config_work/main/udptl.c Thu May 10 18:21:12 2012
@@ -199,7 +199,7 @@
 static int udptl_pre_apply_config(void);
 
 static struct aco_type general_options = {
-	.type = GLOBAL_OBJ,
+	.type = ACO_GLOBAL_OBJ,
 	.global_index = UDPTL_GENERAL, 
 	.category_allow = ACO_WHITELIST,
 	.category = "general",




More information about the asterisk-commits mailing list