Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5b05d12

Browse files
committed
Consolidate start_object calls
1 parent 03aaf18 commit 5b05d12

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

‎src/generic/stage2/structural_parser.h‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,10 @@ WARN_UNUSED really_inline error_code structural_parser::parse(T &builder) noexce
125125
switch (*value) {
126126
case '{': {
127127
if (empty_object(builder)) { goto document_end; }
128-
SIMDJSON_TRY( start_object(builder) );
129128
goto object_begin;
130129
}
131130
case '[': {
132131
if (empty_array(builder)) { goto document_end; }
133-
SIMDJSON_TRY( start_array(builder) );
134132
// Make sure the outer array is closed before continuing; otherwise, there are ways we could get
135133
// into memory corruption. See https://github.com/simdjson/simdjson/issues/906
136134
if (!STREAMING) {
@@ -151,6 +149,7 @@ WARN_UNUSED really_inline error_code structural_parser::parse(T &builder) noexce
151149
// Object parser states
152150
//
153151
object_begin: {
152+
SIMDJSON_TRY( start_object(builder) );
154153
const uint8_t *key = advance();
155154
if (*key != '"') {
156155
log_error("Object does not start with a key");
@@ -167,12 +166,10 @@ object_field: {
167166
switch (*value) {
168167
case '{': {
169168
if (empty_object(builder)) { break; };
170-
SIMDJSON_TRY( start_object(builder) );
171169
goto object_begin;
172170
}
173171
case '[': {
174172
if (empty_array(builder)) { break; };
175-
SIMDJSON_TRY( start_array(builder) );
176173
goto array_begin;
177174
}
178175
default: {
@@ -210,6 +207,7 @@ scope_end: {
210207
// Array parser states
211208
//
212209
array_begin: {
210+
SIMDJSON_TRY( start_array(builder) );
213211
builder.increment_count(*this);
214212
} // array_begin:
215213

@@ -218,12 +216,10 @@ array_value: {
218216
switch (*value) {
219217
case '{': {
220218
if (empty_object(builder)) { break; };
221-
SIMDJSON_TRY( start_object(builder) );
222219
goto object_begin;
223220
}
224221
case '[': {
225222
if (empty_array(builder)) { break; };
226-
SIMDJSON_TRY( start_array(builder) );
227223
goto array_begin;
228224
}
229225
default: {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /