Create a stable C pointer to the N last structs in nested_structs_
| 1829 | |
| 1830 | // Create a stable C pointer to the N last structs in nested_structs_ |
| 1831 | struct ArrowSchema** NLastChildren(int64_t n_children, struct ArrowSchema* parent) { |
| 1832 | children_arrays_.emplace_back(n_children); |
| 1833 | struct ArrowSchema** children = children_arrays_.back().data(); |
| 1834 | int64_t nested_offset; |
| 1835 | // If parent is itself at the end of nested_structs_, skip it |
| 1836 | if (parent != nullptr && &nested_structs_.back() == parent) { |
| 1837 | nested_offset = static_cast<int64_t>(nested_structs_.size()) - n_children - 1; |
| 1838 | } else { |
| 1839 | nested_offset = static_cast<int64_t>(nested_structs_.size()) - n_children; |
| 1840 | } |
| 1841 | for (int64_t i = 0; i < n_children; ++i) { |
| 1842 | children[i] = &nested_structs_[nested_offset + i]; |
| 1843 | } |
| 1844 | return children; |
| 1845 | } |
| 1846 | |
| 1847 | struct ArrowSchema* LastChild(struct ArrowSchema* parent = nullptr) { |
| 1848 | return *NLastChildren(1, parent); |
nothing calls this directly
no test coverage detected