Create a stable C pointer to the N last structs in nested_structs_
| 1799 | |
| 1800 | // Create a stable C pointer to the N last structs in nested_structs_ |
| 1801 | struct ArrowSchema** NLastChildren(int64_t n_children, struct ArrowSchema* parent) { |
| 1802 | children_arrays_.emplace_back(n_children); |
| 1803 | struct ArrowSchema** children = children_arrays_.back().data(); |
| 1804 | int64_t nested_offset; |
| 1805 | // If parent is itself at the end of nested_structs_, skip it |
| 1806 | if (parent != nullptr && &nested_structs_.back() == parent) { |
| 1807 | nested_offset = static_cast<int64_t>(nested_structs_.size()) - n_children - 1; |
| 1808 | } else { |
| 1809 | nested_offset = static_cast<int64_t>(nested_structs_.size()) - n_children; |
| 1810 | } |
| 1811 | for (int64_t i = 0; i < n_children; ++i) { |
| 1812 | children[i] = &nested_structs_[nested_offset + i]; |
| 1813 | } |
| 1814 | return children; |
| 1815 | } |
| 1816 | |
| 1817 | struct ArrowSchema* LastChild(struct ArrowSchema* parent = nullptr) { |
| 1818 | return *NLastChildren(1, parent); |
nothing calls this directly
no test coverage detected