Grow a string list for one more entry at `idx`: the capacity doubles at * every power of two, so n appends cost O(n) copying, not O(n^2). */
| 4348 | /* Grow a string list for one more entry at `idx`: the capacity doubles at |
| 4349 | * every power of two, so n appends cost O(n) copying, not O(n^2). */ |
| 4350 | static char **string_list_reserve(char **list, int idx) { |
| 4351 | if (idx > 0 && (idx & (idx - SKIP_ONE)) != 0) { |
| 4352 | return list; /* capacity is the next power of two above idx */ |
| 4353 | } |
| 4354 | return safe_realloc(list, (size_t)(idx ? idx * PAIR_LEN : SKIP_ONE) * sizeof(char *)); |
| 4355 | } |
| 4356 | |
| 4357 | enum { DISTINCT_SET_MIN = 16 }; /* below this a set is scanned, not hashed */ |
| 4358 |
no test coverage detected