@@ -162,6 +162,10 @@ struct structural_parser {
162162 return false ;
163163 }
164164
165+ really_inline void increment_count () {
166+ doc_parser.increment_count (doc_parser.containing_scope [depth - 1 ]); // we have a key value pair in the object at parser.depth - 1
167+ }
168+
165169 WARN_UNUSED really_inline bool parse_string () {
166170 uint8_t *dst = doc_parser.on_start_string ();
167171 dst = stringparsing::parse_string (structurals.current (), dst);
@@ -376,7 +380,7 @@ WARN_UNUSED error_code implementation::stage2(const uint8_t *buf, size_t len, pa
376380object_begin:
377381 switch (parser.advance_char ()) {
378382 case ' "' : {
379- doc_parser .increment_count (doc_parser. containing_scope [parser. depth - 1 ]); // we have a key value pair in the object at parser.depth - 1
383+ parser .increment_count ();
380384 FAIL_IF ( parser.parse_string () );
381385 goto object_key_state;
382386 }
@@ -395,7 +399,7 @@ WARN_UNUSED error_code implementation::stage2(const uint8_t *buf, size_t len, pa
395399object_continue:
396400 switch (parser.advance_char ()) {
397401 case ' ,' :
398- doc_parser .increment_count (doc_parser. containing_scope [parser. depth - 1 ]); // we have a key value pair in the object at parser.depth - 1
402+ parser .increment_count ();
399403 FAIL_IF ( parser.advance_char () != ' "' );
400404 FAIL_IF ( parser.parse_string () );
401405 goto object_key_state;
@@ -417,7 +421,7 @@ WARN_UNUSED error_code implementation::stage2(const uint8_t *buf, size_t len, pa
417421 parser.end_array ();
418422 goto scope_end;
419423 }
420- doc_parser .increment_count (doc_parser. containing_scope [parser. depth - 1 ]); // we have a new value in the array at parser.depth - 1
424+ parser .increment_count ();
421425
422426main_array_switch:
423427 /* we call update char on all paths in, so we can peek at parser.c on the
@@ -427,7 +431,7 @@ WARN_UNUSED error_code implementation::stage2(const uint8_t *buf, size_t len, pa
427431array_continue:
428432 switch (parser.advance_char ()) {
429433 case ' ,' :
430- doc_parser .increment_count (doc_parser. containing_scope [parser. depth - 1 ]); // we have a new value in the array at parser.depth - 1
434+ parser .increment_count ();
431435 parser.advance_char ();
432436 goto main_array_switch;
433437 case ' ]' :
0 commit comments