@@ -115,26 +115,20 @@ WARN_UNUSED really_inline error_code structural_parser::parse(T &builder) noexce
115
115
{
116
116
const uint8_t *value = advance ();
117
117
switch (*value) {
118
- case ' {' : {
119
- if (empty_object (builder)) { goto document_end; }
120
- goto object_begin;
121
- }
118
+ case ' {' : if (!empty_object (builder)) { goto object_begin; }; break ;
122
119
case ' [' : {
123
- if (empty_array (builder)) { goto document_end; }
124
120
// Make sure the outer array is closed before continuing; otherwise, there are ways we could get
125
121
// into memory corruption. See https://github.com/simdjson/simdjson/issues/906
126
122
if (!STREAMING) {
127
123
if (buf[dom_parser.structural_indexes [dom_parser.n_structural_indexes - 1 ]] != ' ]' ) {
128
124
return TAPE_ERROR;
129
125
}
130
126
}
131
- goto array_begin;
132
- }
133
- default : {
134
- SIMDJSON_TRY ( builder.parse_root_primitive (*this , value) );
135
- goto document_end;
127
+ if (!empty_array (builder)) { goto array_begin; }; break ;
136
128
}
129
+ default : SIMDJSON_TRY ( builder.parse_root_primitive (*this , value) );
137
130
}
131
+ goto document_end;
138
132
}
139
133
140
134
//
@@ -160,17 +154,9 @@ object_field: {
160
154
if (unlikely ( advance_char () != ' :' )) { log_error (" Missing colon after key in object" ); return TAPE_ERROR; }
161
155
const uint8_t *value = advance ();
162
156
switch (*value) {
163
- case ' {' : {
164
- if (empty_object (builder)) { break ; };
165
- goto object_begin;
166
- }
167
- case ' [' : {
168
- if (empty_array (builder)) { break ; };
169
- goto array_begin;
170
- }
171
- default : {
172
- SIMDJSON_TRY ( builder.parse_primitive (*this , value) );
173
- }
157
+ case ' {' : if (!empty_object (builder)) { goto object_begin; }; break ;
158
+ case ' [' : if (!empty_array (builder)) { goto array_begin; }; break ;
159
+ default : SIMDJSON_TRY ( builder.parse_primitive (*this , value) );
174
160
}
175
161
} // object_field:
176
162
@@ -214,17 +200,9 @@ array_begin: {
214
200
array_value: {
215
201
const uint8_t *value = advance ();
216
202
switch (*value) {
217
- case ' {' : {
218
- if (empty_object (builder)) { break ; };
219
- goto object_begin;
220
- }
221
- case ' [' : {
222
- if (empty_array (builder)) { break ; };
223
- goto array_begin;
224
- }
225
- default : {
226
- SIMDJSON_TRY ( builder.parse_primitive (*this , value) );
227
- }
203
+ case ' {' : if (!empty_object (builder)) { goto object_begin; }; break ;
204
+ case ' [' : if (!empty_array (builder)) { goto array_begin; }; break ;
205
+ default : SIMDJSON_TRY ( builder.parse_primitive (*this , value) );
228
206
}
229
207
} // array_value:
230
208
0 commit comments