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

Function adr_first_paragraph

internal/cbm/doc_adr.c:880–900  ·  view source on GitHub ↗

The paragraph after heading h (its first non-blank text lines). */

Source from the content-addressed store, hash-verified

878
879/* The paragraph after heading h (its first non-blank text lines). */
880static char *adr_first_paragraph(CBMArena *a, const adr_doc_t *d, int h, size_t cap) {
881 int start = d->heads[h].line + SKIP_ONE;
882 int end = h + SKIP_ONE < d->nheads ? d->heads[h + SKIP_ONE].line : d->L.count;
883 int k = start;
884 while (k < end &&
885 (!d->L.v[k].text || d->L.v[k].n == 0 || adr_trim_eq(d->L.v[k].s, d->L.v[k].n, "") ||
886 d->L.v[k].s[0] == '=' || d->L.v[k].s[0] == '-')) {
887 k++;
888 }
889 if (k >= end) {
890 return NULL;
891 }
892 const char *s = d->L.v[k].s;
893 int last = k;
894 while (last + SKIP_ONE < end && d->L.v[last + SKIP_ONE].text &&
895 !adr_trim_eq(d->L.v[last + SKIP_ONE].s, d->L.v[last + SKIP_ONE].n, "")) {
896 last++;
897 }
898 const char *e = d->L.v[last].s + d->L.v[last].n;
899 return adr_plain(a, s, (size_t)(e - s), cap);
900}
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) {

Callers 1

cbm_adr_extractFunction · 0.85

Calls 2

adr_trim_eqFunction · 0.85
adr_plainFunction · 0.85

Tested by

no test coverage detected