From 2c8fd109de1ff303dd99104be8ee271e761af940 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Mon, 11 May 2020 04:58:50 -0700 Subject: [PATCH] Move increment_count to stage 2 --- include/simdjson/document.h | 1 - src/document_parser_callbacks.h | 7 ------- src/generic/stage2_build_tape.h | 6 +++++- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/simdjson/document.h b/include/simdjson/document.h index 4002aea63..1c85e2a8c 100644 --- a/include/simdjson/document.h +++ b/include/simdjson/document.h @@ -1042,7 +1042,6 @@ public: really_inline bool on_number_u64(uint64_t value) noexcept; ///< @private really_inline bool on_number_double(double value) noexcept; ///< @private - really_inline void increment_count(scope_descriptor &scope) noexcept; ///< @private really_inline void end_scope(uint32_t depth) noexcept; ///< @private private: /** diff --git a/src/document_parser_callbacks.h b/src/document_parser_callbacks.h index 5dd5b1eed..21a980f69 100644 --- a/src/document_parser_callbacks.h +++ b/src/document_parser_callbacks.h @@ -26,13 +26,6 @@ really_inline error_code parser::on_success(error_code success_code) noexcept { valid = true; return success_code; } -// increment_count increments the count of keys in an object or values in an array. -// Note that if you are at the level of the values or elements, the count -// must be increment in the preceding depth (depth-1) where the array or -// the object resides. -really_inline void parser::increment_count(scope_descriptor &scope) noexcept { - scope.count++; -} really_inline bool parser::on_start_document(uint32_t depth) noexcept { containing_scope[depth].tape_index = current_loc; diff --git a/src/generic/stage2_build_tape.h b/src/generic/stage2_build_tape.h index cea9eda21..77c0d5ab2 100644 --- a/src/generic/stage2_build_tape.h +++ b/src/generic/stage2_build_tape.h @@ -162,8 +162,12 @@ struct structural_parser { return false; } +// increment_count increments the count of keys in an object or values in an array. +// Note that if you are at the level of the values or elements, the count +// must be increment in the preceding depth (depth-1) where the array or +// the object resides. really_inline void increment_count() { - doc_parser.increment_count(doc_parser.containing_scope[depth - 1]); // we have a key value pair in the object at parser.depth - 1 + doc_parser.containing_scope[depth - 1].count++; // we have a key value pair in the object at parser.depth - 1 } WARN_UNUSED really_inline bool parse_string() {