From 3661f801a5ba063ceebc706ad9a923a5f112ad6f Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Thu, 27 Feb 2014 13:32:50 +0100 Subject: [PATCH] Refactored getNestedTokenCount() --- JsonObjectBase.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/JsonObjectBase.cpp b/JsonObjectBase.cpp index bd88f040..52baee0f 100644 --- a/JsonObjectBase.cpp +++ b/JsonObjectBase.cpp @@ -10,12 +10,14 @@ int JsonObjectBase::getNestedTokenCount(jsmntok_t* token) { - int count = 0; - jsmntok_t* nextSibling = token + 1; + int end = token->end; + int count = 0; - while (nextSibling->start < token->end) + token++; + + while (token->start < end) { - nextSibling++; + token++; count++; }