| 6217 | } |
| 6218 | |
| 6219 | void push_back(const xpath_node& node, xpath_allocator* alloc) |
| 6220 | { |
| 6221 | if (_end == _eos) |
| 6222 | { |
| 6223 | size_t capacity = static_cast<size_t>(_eos - _begin); |
| 6224 | |
| 6225 | // get new capacity (1.5x rule) |
| 6226 | size_t new_capacity = capacity + capacity / 2 + 1; |
| 6227 | |
| 6228 | // reallocate the old array or allocate a new one |
| 6229 | xpath_node* data = static_cast<xpath_node*>(alloc->reallocate(_begin, capacity * sizeof(xpath_node), new_capacity * sizeof(xpath_node))); |
| 6230 | assert(data); |
| 6231 | |
| 6232 | // finalize |
| 6233 | _begin = data; |
| 6234 | _end = data + capacity; |
| 6235 | _eos = data + new_capacity; |
| 6236 | } |
| 6237 | |
| 6238 | *_end++ = node; |
| 6239 | } |
| 6240 | |
| 6241 | void append(const xpath_node* begin, const xpath_node* end, xpath_allocator* alloc) |
| 6242 | { |
no test coverage detected