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