| 9136 | } |
| 9137 | |
| 9138 | void append(const xpath_node* begin_, const xpath_node* end_, xpath_allocator* alloc) |
| 9139 | { |
| 9140 | if (begin_ == end_) return; |
| 9141 | |
| 9142 | size_t size_ = static_cast<size_t>(_end - _begin); |
| 9143 | size_t capacity = static_cast<size_t>(_eos - _begin); |
| 9144 | size_t count = static_cast<size_t>(end_ - begin_); |
| 9145 | |
| 9146 | if (size_ + count > capacity) |
| 9147 | { |
| 9148 | // reallocate the old array or allocate a new one |
| 9149 | xpath_node* data = static_cast<xpath_node*>(alloc->reallocate(_begin, capacity * sizeof(xpath_node), (size_ + count) * sizeof(xpath_node))); |
| 9150 | if (!data) return; |
| 9151 | |
| 9152 | // finalize |
| 9153 | _begin = data; |
| 9154 | _end = data + size_; |
| 9155 | _eos = data + size_ + count; |
| 9156 | } |
| 9157 | |
| 9158 | memcpy(_end, begin_, count * sizeof(xpath_node)); |
| 9159 | _end += count; |
| 9160 | } |
| 9161 | |
| 9162 | void sort_do() |
| 9163 | { |
no test coverage detected