summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-06-13 18:14:38 +0000
committerMatthew Jordan <mjordan@digium.com>2013-06-13 18:14:38 +0000
commit1cb25deeba899dc1e4a2c51ba5934cc258b5c91f (patch)
tree5c86a79a47d397fdcbf9f64fcca3b39fb81044d8 /main
parentb51b437bf3d47111451117dc0a04faa6356ba30c (diff)
Blow away usage of libjansson's foreach macro
While very handy, this macro didn't occur until a later version of libjansson. We'd prefer to be compatible with older versions still - as such, iteration over key/value pairs in a JSON object have to be done with a little bit more manual work. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391675 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/json.c4
-rw-r--r--main/manager.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/main/json.c b/main/json.c
index 70830bd13..a403b40cf 100644
--- a/main/json.c
+++ b/main/json.c
@@ -330,10 +330,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)
{
return (struct ast_json *)json_object_iter_value(iter);
diff --git a/main/manager.c b/main/manager.c
index eb01cc536..0e402aeb8 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1278,12 +1278,16 @@ struct ast_str *ast_manager_str_from_json_object(struct ast_json *blob, key_excl
{
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;
}