Skip to content

Commit bbd87c8

Browse files
committed
Merge branch 'vnorilo-master'
2 parents 9913da8 + 696ea41 commit bbd87c8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

JSONParser.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,17 @@ macro(_sbeParseValue prefix)
182182
set(json_inValue no)
183183

184184
while(${json_index} LESS ${json_jsonLen})
185+
# fast path for copying strings
186+
if (json_inValue)
187+
# attempt to gobble up to 128 bytes of string
188+
string(SUBSTRING "${json_string}" ${json_index} 128 try_gobble)
189+
# consume a piece of string we can just straight copy before encountering \ or "
190+
string(REGEX MATCH "^[^\"\\\\]+" simple_copy "${try_gobble}")
191+
string(CONCAT json_value "${json_value}" "${simple_copy}")
192+
string(LENGTH "${simple_copy}" copy_length)
193+
math(EXPR json_index "${json_index} + ${copy_length}")
194+
endif()
195+
185196
string(SUBSTRING "${json_string}" ${json_index} 1 json_char)
186197

187198
# check if json_value ends, it is ended by "

0 commit comments

Comments
 (0)