[asterisk-commits] mmichelson: branch mmichelson/transfer_stasis r391681 - in /team/mmichelson/t...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 13 13:18:26 CDT 2013


Author: mmichelson
Date: Thu Jun 13 13:18:23 2013
New Revision: 391681

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391681
Log:
Get the jump on automerge since I want to get this up for review.


Modified:
    team/mmichelson/transfer_stasis/   (props changed)
    team/mmichelson/transfer_stasis/include/asterisk/json.h
    team/mmichelson/transfer_stasis/main/features_config.c
    team/mmichelson/transfer_stasis/main/json.c
    team/mmichelson/transfer_stasis/main/manager.c

Propchange: team/mmichelson/transfer_stasis/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jun 13 13:18:23 2013
@@ -1,1 +1,1 @@
-/trunk:1-391659
+/trunk:1-391679

Modified: team/mmichelson/transfer_stasis/include/asterisk/json.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/include/asterisk/json.h?view=diff&rev=391681&r1=391680&r2=391681
==============================================================================
--- team/mmichelson/transfer_stasis/include/asterisk/json.h (original)
+++ team/mmichelson/transfer_stasis/include/asterisk/json.h Thu Jun 13 13:18:23 2013
@@ -604,15 +604,6 @@
 const char *ast_json_object_iter_key(struct ast_json_iter *iter);
 
 /*!
- * \brief Retrieve the iterator object for a particular key
- * \since 12.0.0
- *
- * \param key Key of the field the \c ast_json_iter points to
- * \return \ref ast_json_iter object that points to \a key
- */
-struct ast_json_iter *ast_json_object_key_to_iter(const char *key);
-
-/*!
  * \brief Get the value from an iterator.
  * \since 12.0.0
  *
@@ -638,23 +629,6 @@
  * \return -1 on error.
  */
 int ast_json_object_iter_set(struct ast_json *object, struct ast_json_iter *iter, struct ast_json *value);
-
-/*!
- * \brief Iterate over key/value pairs
- *
- * \note This is a reproduction of the jansson library's \ref json_object_foreach
- * using the equivalent ast_* wrapper functions. This creates a for loop using the various
- * iteration function calls.
- *
- * \param object The \ref ast_json object that contains key/value tuples to iterate over
- * \param key A \c const char pointer key for the key/value tuple
- * \param value A \ref ast_json object for the key/value tuple
- */
-#define ast_json_object_foreach(object, key, value) \
-	for (key = ast_json_object_iter_key(ast_json_object_iter(object)); \
-		key && (value = ast_json_object_iter_value(ast_json_object_key_to_iter(key))); \
-		key = ast_json_object_iter_key(ast_json_object_iter_next(object, ast_json_object_key_to_iter(key))))
-
 
 /*!@}*/
 

Modified: team/mmichelson/transfer_stasis/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/features_config.c?view=diff&rev=391681&r1=391680&r2=391681
==============================================================================
--- team/mmichelson/transfer_stasis/main/features_config.c (original)
+++ team/mmichelson/transfer_stasis/main/features_config.c Thu Jun 13 13:18:23 2013
@@ -1345,9 +1345,9 @@
 	.write = featuremap_write
 };
 
-static int load_config(int reload)
-{
-	if (!reload && aco_info_init(&cfg_info)) {
+static int load_config(void)
+{
+	if (aco_info_init(&cfg_info)) {
 		ast_log(LOG_ERROR, "Unable to initialize configuration info for features\n");
 		return -1;
 	}
@@ -1441,10 +1441,8 @@
 
 	if (aco_process_config(&cfg_info, 0) == ACO_PROCESS_ERROR) {
 		ast_log(LOG_ERROR, "Failed to process features.conf configuration!\n");
-		if (!reload) {
-			aco_info_destroy(&cfg_info);
-			ao2_global_obj_release(globals);
-		}
+		aco_info_destroy(&cfg_info);
+		ao2_global_obj_release(globals);
 		return -1;
 	}
 
@@ -1559,14 +1557,17 @@
 
 int ast_features_config_reload(void)
 {
-	return load_config(1);
+	if (aco_process_config(&cfg_info, 1) == ACO_PROCESS_ERROR) {
+		return -1;
+	}
+	return load_config();
 }
 
 int ast_features_config_init(void)
 {
 	int res;
 
-	res = load_config(0);
+	res = load_config();
 	res |= __ast_custom_function_register(&feature_function, NULL);
 	res |= __ast_custom_function_register(&featuremap_function, NULL);
 	res |= ast_cli_register_multiple(cli_features_config, ARRAY_LEN(cli_features_config));

Modified: team/mmichelson/transfer_stasis/main/json.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/json.c?view=diff&rev=391681&r1=391680&r2=391681
==============================================================================
--- team/mmichelson/transfer_stasis/main/json.c (original)
+++ team/mmichelson/transfer_stasis/main/json.c Thu Jun 13 13:18:23 2013
@@ -329,10 +329,6 @@
 const char *ast_json_object_iter_key(struct ast_json_iter *iter)
 {
 	return json_object_iter_key(iter);
-}
-struct ast_json_iter *ast_json_object_key_to_iter(const char *key)
-{
-	return (struct ast_json_iter *)json_object_key_to_iter(key);
 }
 struct ast_json *ast_json_object_iter_value(struct ast_json_iter *iter)
 {

Modified: team/mmichelson/transfer_stasis/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/manager.c?view=diff&rev=391681&r1=391680&r2=391681
==============================================================================
--- team/mmichelson/transfer_stasis/main/manager.c (original)
+++ team/mmichelson/transfer_stasis/main/manager.c Thu Jun 13 13:18:23 2013
@@ -1278,12 +1278,16 @@
 {
 	struct ast_str *output_str = ast_str_create(32);
 	struct ast_json *value;
+	struct ast_json_iter *iter;
 	const char *key;
 	if (!output_str) {
 		return NULL;
 	}
 
-	ast_json_object_foreach(blob, key, value) {
+	for (iter = ast_json_object_iter(blob); iter; iter = ast_json_object_iter_next(blob, iter)) {
+		key = ast_json_object_iter_key(iter);
+		value = ast_json_object_iter_value(iter);
+
 		if (exclusion_cb && exclusion_cb(key)) {
 			continue;
 		}




More information about the asterisk-commits mailing list