| 110 |
110 |
| 111 // guarantee enough capacity |
111 // guarantee enough capacity |
| 112 if (array->capacity < req_capacity) { |
112 if (array->capacity < req_capacity) { |
| 113 const size_t new_capacity = cx_array_grow_capacity(array->capacity,req_capacity); |
113 const size_t new_capacity = cx_array_grow_capacity(array->capacity,req_capacity); |
| 114 if (cxReallocateArray(allocator, &array->data, new_capacity, elem_size)) { |
114 if (cxReallocateArray(allocator, &array->data, new_capacity, elem_size)) { |
| 115 return -1; // LCOV_EXCL_LINE |
115 return -1; |
| 116 } |
116 } |
| 117 array->capacity = new_capacity; |
117 array->capacity = new_capacity; |
| 118 } |
118 } |
| 119 |
119 |
| 120 // determine insert position |
120 // determine insert position |