Don't pass depth to increment_count

This commit is contained in:
John Keiser
2020-05-11 04:15:02 -07:00
parent 2a6e6b3dbd
commit 16d88cc095
4 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -1042,7 +1042,7 @@ 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(uint32_t depth) noexcept; ///< @private
really_inline void increment_count(scope_descriptor &scope) noexcept; ///< @private
really_inline void end_scope(uint32_t depth) noexcept; ///< @private
private:
/**
+2 -2
View File
@@ -30,8 +30,8 @@ really_inline error_code parser::on_success(error_code success_code) noexcept {
// 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(uint32_t depth) noexcept {
containing_scope[depth].count++;
really_inline void parser::increment_count(scope_descriptor &scope) noexcept {
scope.count++;
}
really_inline bool parser::on_start_document(uint32_t depth) noexcept {
+4 -4
View File
@@ -376,7 +376,7 @@ WARN_UNUSED error_code implementation::stage2(const uint8_t *buf, size_t len, pa
object_begin:
switch (parser.advance_char()) {
case '"': {
doc_parser.increment_count(parser.depth - 1); // we have a key value pair in the object at parser.depth - 1
doc_parser.increment_count(doc_parser.containing_scope[parser.depth - 1]); // we have a key value pair in the object at parser.depth - 1
FAIL_IF( parser.parse_string() );
goto object_key_state;
}
@@ -395,7 +395,7 @@ object_key_state:
object_continue:
switch (parser.advance_char()) {
case ',':
doc_parser.increment_count(parser.depth - 1); // we have a key value pair in the object at parser.depth - 1
doc_parser.increment_count(doc_parser.containing_scope[parser.depth - 1]); // we have a key value pair in the object at parser.depth - 1
FAIL_IF( parser.advance_char() != '"' );
FAIL_IF( parser.parse_string() );
goto object_key_state;
@@ -417,7 +417,7 @@ array_begin:
parser.end_array();
goto scope_end;
}
doc_parser.increment_count(parser.depth - 1); // we have a new value in the array at parser.depth - 1
doc_parser.increment_count(doc_parser.containing_scope[parser.depth - 1]); // we have a new value in the array at parser.depth - 1
main_array_switch:
/* we call update char on all paths in, so we can peek at parser.c on the
@@ -427,7 +427,7 @@ main_array_switch:
array_continue:
switch (parser.advance_char()) {
case ',':
doc_parser.increment_count(parser.depth - 1); // we have a new value in the array at parser.depth - 1
doc_parser.increment_count(doc_parser.containing_scope[parser.depth - 1]); // we have a new value in the array at parser.depth - 1
parser.advance_char();
goto main_array_switch;
case ']':
+3 -3
View File
@@ -97,7 +97,7 @@ object_begin:
object_key_parser:
FAIL_IF( parser.advance_char() != ':' );
doc_parser.increment_count(parser.depth - 1); // we have a key value pair in the object at parser.depth - 1
doc_parser.increment_count(doc_parser.containing_scope[parser.depth - 1]); // we have a key value pair in the object at parser.depth - 1
parser.advance_char();
GOTO( parser.parse_value(addresses, addresses.object_continue) );
@@ -125,7 +125,7 @@ array_begin:
parser.end_array();
goto scope_end;
}
doc_parser.increment_count(parser.depth - 1); // we have a new value in the array at parser.depth - 1
doc_parser.increment_count(doc_parser.containing_scope[parser.depth - 1]); // we have a new value in the array at parser.depth - 1
main_array_switch:
/* we call update char on all paths in, so we can peek at parser.c on the
@@ -135,7 +135,7 @@ main_array_switch:
array_continue:
switch (parser.advance_char()) {
case ',':
doc_parser.increment_count(parser.depth - 1); // we have a new value in the array at parser.depth - 1
doc_parser.increment_count(doc_parser.containing_scope[parser.depth - 1]); // we have a new value in the array at parser.depth - 1
parser.advance_char();
goto main_array_switch;
case ']':