| 25 | } |
| 26 | |
| 27 | void hc_vector_grow(struct hc_vector *v, const size_t capacity) { |
| 28 | v->capacity = capacity; |
| 29 | size_t size = v->item_size * (v->capacity+1); |
| 30 | uint8_t *new_start = hc_acquire(v->malloc, size); |
| 31 | |
| 32 | if (v->start) { |
| 33 | memmove(new_start, v->start, v->length * v->item_size); |
| 34 | hc_release(v->malloc, v->start); |
| 35 | } |
| 36 | |
| 37 | v->start = new_start; |
| 38 | v->end = v->start + v->item_size*v->length; |
| 39 | } |
| 40 | |
| 41 | void hc_vector_clear(struct hc_vector *v) { |
| 42 | v->length = 0; |
no outgoing calls
no test coverage detected