From c3eb0fd8e207d173a40e9546d2603841f1bdf19d Mon Sep 17 00:00:00 2001 From: Jonathan Buchanan Date: Tue, 21 Jul 2020 16:34:14 -0400 Subject: change behavior of expanding json paths with arrays --- src/json/json.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/json/json.c') diff --git a/src/json/json.c b/src/json/json.c index bcae6de1..09cc757c 100644 --- a/src/json/json.c +++ b/src/json/json.c @@ -481,7 +481,6 @@ parse_path (json_t *obj, '.'); char *next_path; char *bracket; - json_t *parent = obj; json_t *next_obj = NULL; if (NULL != next_id) @@ -522,15 +521,15 @@ parse_path (json_t *obj, *bracket = '\0'; bracket++; - parent = json_object_get (obj, - next_id); + json_t *array = json_object_get (obj, + next_id); if (0 == strcmp (bracket, "*")) { size_t index; json_t *value; int ret = GNUNET_OK; - json_array_foreach (parent, index, value) { + json_array_foreach (array, index, value) { ret = parse_path (value, obj, next_path, @@ -550,7 +549,7 @@ parse_path (json_t *obj, "%u", &index)) return GNUNET_SYSERR; - next_obj = json_array_get (parent, + next_obj = json_array_get (array, index); } } @@ -564,7 +563,7 @@ parse_path (json_t *obj, if (NULL != next_obj) { return parse_path (next_obj, - parent, + obj, next_path, cb, cb_cls); -- cgit v1.2.3