| 304 | } |
| 305 | |
| 306 | static void pp_err_add(pp_err_list_t *list, const char *path, const char *reason, |
| 307 | const char *phase) { |
| 308 | if (!list) { |
| 309 | return; |
| 310 | } |
| 311 | if (list->count >= list->cap) { |
| 312 | int ncap = list->cap ? list->cap * 2 : 8; |
| 313 | cbm_file_error_t *grown = |
| 314 | (cbm_file_error_t *)realloc(list->items, (size_t)ncap * sizeof(*grown)); |
| 315 | if (!grown) { |
| 316 | return; /* drop on OOM — never fail extraction to record a skip */ |
| 317 | } |
| 318 | list->items = grown; |
| 319 | list->cap = ncap; |
| 320 | } |
| 321 | list->items[list->count].path = pp_err_dup(path); |
| 322 | list->items[list->count].reason = pp_err_dup(reason); |
| 323 | list->items[list->count].phase = pp_err_dup(phase); |
| 324 | list->count++; |
| 325 | } |
| 326 | |
| 327 | /* Free source buffer. */ |
| 328 | static void free_source(char *buf) { |
no test coverage detected