8000 Inline start_object/start_array · JavaScriptExpert/simdjson@9eccd7b · GitHub
[go: up one dir, main page]

Skip to content

Commit 9eccd7b

Browse files
committed
Inline start_object/start_array
1 parent 5b05d12 commit 9eccd7b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/generic/stage2/structural_parser.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@ struct structural_parser : structural_iterator {
3434
return SUCCESS;
3535
}
3636
template<typename T>
37-
WARN_UNUSED really_inline error_code start_object(T &builder) {
38-
depth++;
39-
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
40-
builder.start_object(*this);
41-
dom_parser.is_array[depth] = false;
42-
return SUCCESS;
43-
}
44-
template<typename T>
4537
WARN_UNUSED really_inline error_code start_array(T &builder) {
4638
depth++;
4739
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
@@ -149,7 +141,11 @@ WARN_UNUSED really_inline error_code structural_parser::parse(T &builder) noexce
149141
// Object parser states
150142
//
151143
object_begin: {
152-
SIMDJSON_TRY( start_object(builder) );
144+
depth++;
145+
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
146+
builder.start_object(*this);
147+
dom_parser.is_array[depth] = false;
148+
153149
const uint8_t *key = advance();
154150
if (*key != '"') {
155151
log_error("Object does not start with a key");
@@ -207,7 +203,11 @@ scope_end: {
207203
// Array parser states
208204
//
209205
array_begin: {
210-
SIMDJSON_TRY( start_array(builder) );
206+
depth++;
207+
if (depth >= dom_parser.max_depth()) { log_error("Exceeded max depth!"); return DEPTH_ERROR; }
208+
builder.start_array(*this);
209+
dom_parser.is_array[depth] = true;
210+
211211
builder.increment_count(*this);
212212
} // array_begin:
213213

0 commit comments

Comments
 (0)
0