MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / doc_push_span

Function doc_push_span

internal/cbm/extract_defs.c:1496–1519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1494}
1495
1496static 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. */
1522static void doc_note_code(doc_trivia_t *t, TSNode code) {

Callers 6

doc_scan_kotlin_gapFunction · 0.85
doc_scan_kotlin_backFunction · 0.85
doc_collect_cachedFunction · 0.85
doc_collect_cursorFunction · 0.85
doc_go_packageFunction · 0.85
doc_rust_innerFunction · 0.85

Calls 2

cbm_arena_allocFunction · 0.70

Tested by

no test coverage detected