| 371 | }; |
| 372 | |
| 373 | static bool ti_grow(void **items, int *cap, int count, size_t size) { |
| 374 | if (count < *cap) { |
| 375 | return true; |
| 376 | } |
| 377 | int next = *cap ? *cap * 2 : 8; |
| 378 | void *grown = cbm_realloc(CBM_MEM_CLASS_EXTRACT, *items, (size_t)next * size); |
| 379 | if (!grown) { |
| 380 | return false; |
| 381 | } |
| 382 | *items = grown; |
| 383 | *cap = next; |
| 384 | return true; |
| 385 | } |
| 386 | |
| 387 | static bool ti_ints_push(ti_ints_t *a, int v) { |
| 388 | if (!ti_grow((void **)&a->items, &a->cap, a->count, sizeof(*a->items))) { |
no test coverage detected