| 1494 | } |
| 1495 | |
| 1496 | static void doc_push_span(CBMArena *a, doc_trivia_t *t, const doc_span_t *sp) { |
| 1497 | if (t->count == t->cap) { |
| 1498 | int ncap = t->cap ? t->cap * DOC_SPAN_GROW : DOC_SPAN_INIT_CAP; |
| 1499 | doc_span_t *grown; |
| 1500 | #if defined(CBM_ENABLE_TEST_SEAMS) && CBM_ENABLE_TEST_SEAMS |
| 1501 | if (cbm_doclink_test_fail_alloc(CBM_DOCLINK_ALLOC_SPAN)) { |
| 1502 | grown = NULL; |
| 1503 | } else |
| 1504 | #endif |
| 1505 | { |
| 1506 | grown = (doc_span_t *)cbm_arena_alloc(a, (size_t)ncap * sizeof(doc_span_t)); |
| 1507 | } |
| 1508 | if (!grown) { |
| 1509 | t->failed = true; |
| 1510 | return; |
| 1511 | } |
| 1512 | if (t->count > 0) { |
| 1513 | memcpy(grown, t->items, (size_t)t->count * sizeof(doc_span_t)); |
| 1514 | } |
| 1515 | t->items = grown; |
| 1516 | t->cap = ncap; |
| 1517 | } |
| 1518 | t->items[t->count++] = *sp; |
| 1519 | } |
| 1520 | |
| 1521 | /* A non-trivia sibling before the anchor: trivia seen so far are not its. */ |
| 1522 | static void doc_note_code(doc_trivia_t *t, TSNode code) { |
no test coverage detected