| 2556 | } |
| 2557 | |
| 2558 | static void pod_index_push(CBMArena *a, pod_index_t *ix, const pod_sec_t *sec) { |
| 2559 | if (ix->count == ix->cap) { |
| 2560 | int ncap = ix->cap ? ix->cap * DOC_SPAN_GROW : DOC_SPAN_INIT_CAP; |
| 2561 | pod_sec_t *grown = (pod_sec_t *)cbm_arena_alloc(a, (size_t)ncap * sizeof(pod_sec_t)); |
| 2562 | if (!grown) { |
| 2563 | return; |
| 2564 | } |
| 2565 | if (ix->count > 0) { |
| 2566 | memcpy(grown, ix->items, (size_t)ix->count * sizeof(pod_sec_t)); |
| 2567 | } |
| 2568 | ix->items = grown; |
| 2569 | ix->cap = ncap; |
| 2570 | } |
| 2571 | ix->items[ix->count++] = *sec; |
| 2572 | } |
| 2573 | |
| 2574 | /* Index the named =head / =item sections of one POD block. */ |
| 2575 | static void pod_index_block(CBMExtractCtx *ctx, pod_index_t *ix, TSNode pod) { |
no test coverage detected