gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: change behavior of expanding jso


From: gnunet
Subject: [taler-exchange] branch master updated: change behavior of expanding json paths with arrays
Date: Tue, 21 Jul 2020 22:34:24 +0200

This is an automated email from the git hooks/post-receive script.

jonathan-buchanan pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new c3eb0fd8 change behavior of expanding json paths with arrays
c3eb0fd8 is described below

commit c3eb0fd8e207d173a40e9546d2603841f1bdf19d
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Tue Jul 21 16:34:14 2020 -0400

    change behavior of expanding json paths with arrays
---
 src/json/json.c      | 11 +++++------
 src/json/test_json.c | 20 --------------------
 2 files changed, 5 insertions(+), 26 deletions(-)

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);
diff --git a/src/json/test_json.c b/src/json/test_json.c
index a9947520..83509f8f 100644
--- a/src/json/test_json.c
+++ b/src/json/test_json.c
@@ -236,26 +236,6 @@ test_contract ()
     GNUNET_assert (3 == tp.results_length);
     GNUNET_assert (0 == tp.cmp_result);
   }
-  {
-    const char *object_ids[] = { "fruit[0]" };
-    const json_t *parents[] = {
-      json_object_get (c4,
-                       "fruit")
-    };
-    struct TestPath_Closure tp = {
-      .object_ids = object_ids,
-      .parents = parents,
-      .results_length = 0,
-      .cmp_result = 0
-    };
-    GNUNET_assert (GNUNET_OK ==
-                   TALER_JSON_expand_path (c4,
-                                           "$.fruit[0]",
-                                           &path_cb,
-                                           &tp));
-    GNUNET_assert (1 == tp.results_length);
-    GNUNET_assert (0 == tp.cmp_result);
-  }
   json_decref (c4);
   if (0 !=
       GNUNET_memcmp (&h1,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]