MCPcopy Create free account
hub / github.com/bytedance/sonic-cpp / EndArray

Method EndArray

include/sonic/dom/schema_handler.h:273–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271 }
272
273 sonic_force_inline bool EndArray(uint32_t count) {
274 // Assert cur_node != nullptr!!
275 NodeType *arr_ptr;
276 void *arr_element_ptr;
277 if (parent_ == 0) { //
278 arr_ptr = parent_node_;
279 arr_element_ptr = &st_[1];
280 cur_node_ = parent_node_;
281 parent_node_ = parent_st_.back();
282 parent_st_.pop_back();
283 np_ = 0;
284 parent_ = 0;
285 } else {
286 arr_ptr = &st_[parent_];
287 arr_element_ptr = &st_[parent_ + 1];
288 np_ = parent_ + 1;
289 parent_ = arr_ptr->o.next.ofs;
290 }
291 NodeType &arr = *arr_ptr;
292 arr.setLength(count, kArray);
293 if (count) {
294 arr.setChildren(arr.template containerMalloc<NodeType>(count, *alloc_));
295 internal::Xmemcpy<sizeof(NodeType)>(
296 (void *)arr.getArrChildrenFirstUnsafe(), arr_element_ptr, count);
297 } else {
298 arr.setChildren(nullptr);
299 }
300 return true;
301 }
302 static constexpr bool check_key_return = true;
303
304 private:

Callers

nothing calls this directly

Calls 2

setChildrenMethod · 0.80

Tested by

no test coverage detected