| 8575 | } |
| 8576 | |
| 8577 | void append(const xpath_node* begin_, const xpath_node* end_, xpath_allocator* alloc) |
| 8578 | { |
| 8579 | if (begin_ == end_) return; |
| 8580 | |
| 8581 | size_t size_ = static_cast<size_t>(_end - _begin); |
| 8582 | size_t capacity = static_cast<size_t>(_eos - _begin); |
| 8583 | size_t count = static_cast<size_t>(end_ - begin_); |
| 8584 | |
| 8585 | if (size_ + count > capacity) |
| 8586 | { |
| 8587 | // reallocate the old array or allocate a new one |
| 8588 | xpath_node* data = static_cast<xpath_node*>(alloc->reallocate(_begin, capacity * sizeof(xpath_node), (size_ + count) * sizeof(xpath_node))); |
| 8589 | assert(data); |
| 8590 | |
| 8591 | // finalize |
| 8592 | _begin = data; |
| 8593 | _end = data + size_; |
| 8594 | _eos = data + size_ + count; |
| 8595 | } |
| 8596 | |
| 8597 | memcpy(_end, begin_, count * sizeof(xpath_node)); |
| 8598 | _end += count; |
| 8599 | } |
| 8600 | |
| 8601 | void sort_do() |
| 8602 | { |