| 287 | } |
| 288 | |
| 289 | static void pp_err_add(pp_err_list_t *list, const char *path, const char *reason, |
| 290 | const char *phase) { |
| 291 | if (!list) { |
| 292 | return; |
| 293 | } |
| 294 | if (list->count >= list->cap) { |
| 295 | int ncap = list->cap ? list->cap * 2 : 8; |
| 296 | cbm_file_error_t *grown = |
| 297 | (cbm_file_error_t *)realloc(list->items, (size_t)ncap * sizeof(*grown)); |
| 298 | if (!grown) { |
| 299 | return; /* drop on OOM — never fail extraction to record a skip */ |
| 300 | } |
| 301 | list->items = grown; |
| 302 | list->cap = ncap; |
| 303 | } |
| 304 | list->items[list->count].path = pp_err_dup(path); |
| 305 | list->items[list->count].reason = pp_err_dup(reason); |
| 306 | list->items[list->count].phase = pp_err_dup(phase); |
| 307 | list->count++; |
| 308 | } |
| 309 | |
| 310 | /* Free source buffer. */ |
| 311 | static void free_source(char *buf) { |
no test coverage detected