[Pkg-bitcoin-commits] [libunivalue] 69/76: Omit Obj/Arr open token from jsonTokenIsValue() test

Jonas Smedegaard dr at jones.dk
Mon Apr 4 09:18:34 UTC 2016


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

js pushed a commit to branch master
in repository libunivalue.

commit eb6cd6430540ed412f27ba053a76008ddad69e1d
Author: Jeff Garzik <jeff at bloq.com>
Date:   Sat Nov 7 13:24:29 2015 -0500

    Omit Obj/Arr open token from jsonTokenIsValue() test
    
    More correct, less caller specific.
---
 include/univalue.h    | 2 --
 lib/univalue_read.cpp | 7 ++++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/univalue.h b/include/univalue.h
index 932412e..8428b1c 100644
--- a/include/univalue.h
+++ b/include/univalue.h
@@ -246,8 +246,6 @@ extern const char *uvTypeName(UniValue::VType t);
 static inline bool jsonTokenIsValue(enum jtokentype jtt)
 {
     switch (jtt) {
-    case JTOK_OBJ_OPEN:
-    case JTOK_ARR_OPEN:
     case JTOK_KW_NULL:
     case JTOK_KW_TRUE:
     case JTOK_KW_FALSE:
diff --git a/lib/univalue_read.cpp b/lib/univalue_read.cpp
index ab1fba8..6b956c3 100644
--- a/lib/univalue_read.cpp
+++ b/lib/univalue_read.cpp
@@ -271,15 +271,16 @@ bool UniValue::read(const char *raw)
             return false;
         raw += consumed;
 
-        bool isValue = jsonTokenIsValue(tok);
+        bool isValueOpen = jsonTokenIsValue(tok) ||
+            tok == JTOK_OBJ_OPEN || tok == JTOK_ARR_OPEN;
 
         if (expect(VALUE)) {
-            if (!isValue)
+            if (!isValueOpen)
                 return false;
             clearExpect(VALUE);
 
         } else if (expect(ARR_VALUE)) {
-            bool isArrValue = isValue || (tok == JTOK_ARR_CLOSE);
+            bool isArrValue = isValueOpen || (tok == JTOK_ARR_CLOSE);
             if (!isArrValue)
                 return false;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/libunivalue.git



More information about the Pkg-bitcoin-commits mailing list