Skip to content

Commit 2c8fd10

Browse files
committed
Move increment_count to stage 2
1 parent 07fe7ad commit 2c8fd10

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

include/simdjson/document.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,6 @@ class parser {
10421042
really_inline bool on_number_u64(uint64_t value) noexcept; ///< @private
10431043
really_inline bool on_number_double(double value) noexcept; ///< @private
10441044

1045-
really_inline void increment_count(scope_descriptor &scope) noexcept; ///< @private
10461045
really_inline void end_scope(uint32_t depth) noexcept; ///< @private
10471046
private:
10481047
/**

src/document_parser_callbacks.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ really_inline error_code parser::on_success(error_code success_code) noexcept {
2626
valid = true;
2727
return success_code;
2828
}
29-
// increment_count increments the count of keys in an object or values in an array.
30-
// Note that if you are at the level of the values or elements, the count
31-
// must be increment in the preceding depth (depth-1) where the array or
32-
// the object resides.
33-
really_inline void parser::increment_count(scope_descriptor &scope) noexcept {
34-
scope.count++;
35-
}
3629

3730
really_inline bool parser::on_start_document(uint32_t depth) noexcept {
3831
containing_scope[depth].tape_index = current_loc;

src/generic/stage2_build_tape.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,12 @@ struct structural_parser {
162162
return false;
163163
}
164164

165+
// increment_count increments the count of keys in an object or values in an array.
166+
// Note that if you are at the level of the values or elements, the count
167+
// must be increment in the preceding depth (depth-1) where the array or
168+
// the object resides.
165169
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
170+
doc_parser.containing_scope[depth - 1].count++; // we have a key value pair in the object at parser.depth - 1
167171
}
168172

169173
WARN_UNUSED really_inline bool parse_string() {

0 commit comments

Comments
 (0)