| 314 | } |
| 315 | |
| 316 | static void pp_err_add(pp_err_list_t *list, const char *path, const char *reason, |
| 317 | const char *phase) { |
| 318 | if (!list) { |
| 319 | return; |
| 320 | } |
| 321 | if (list->count >= list->cap) { |
| 322 | int ncap = list->cap ? list->cap * 2 : 8; |
| 323 | cbm_file_error_t *grown = |
| 324 | (cbm_file_error_t *)realloc(list->items, (size_t)ncap * sizeof(*grown)); |
| 325 | if (!grown) { |
| 326 | return; /* drop on OOM — never fail extraction to record a skip */ |
| 327 | } |
| 328 | list->items = grown; |
| 329 | list->cap = ncap; |
| 330 | } |
| 331 | list->items[list->count].path = pp_err_dup(path); |
| 332 | list->items[list->count].reason = pp_err_dup(reason); |
| 333 | list->items[list->count].phase = pp_err_dup(phase); |
| 334 | list->count++; |
| 335 | } |
| 336 | |
| 337 | /* Free source buffer. */ |
| 338 | static void free_source(char *buf) { |
no test coverage detected