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

Function adr_section_text

internal/cbm/doc_adr.c:903–912  ·  view source on GitHub ↗

The text of section h, as one collapsed string. */

Source from the content-addressed store, hash-verified

901
902/* The text of section h, as one collapsed string. */
903static char *adr_section_text(CBMArena *a, const adr_doc_t *d, int h, size_t cap) {
904 int start = d->heads[h].line + SKIP_ONE;
905 int end = h + SKIP_ONE < d->nheads ? d->heads[h + SKIP_ONE].line : d->L.count;
906 if (start >= end) {
907 return NULL;
908 }
909 const char *s = d->L.v[start].s;
910 const char *e = d->L.v[end - SKIP_ONE].s + d->L.v[end - SKIP_ONE].n;
911 return e > s ? adr_plain(a, s, (size_t)(e - s), cap) : NULL;
912}
913
914static int adr_find_section(const adr_doc_t *d, adr_sec_t kind) {
915 for (int h = 0; h < d->nheads; h++) {

Callers 1

cbm_adr_extractFunction · 0.85

Calls 1

adr_plainFunction · 0.85

Tested by

no test coverage detected