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

Function cbm_first_line

internal/cbm/cbm.c:324–343  ·  view source on GitHub ↗

A definition name never spans lines. Config extractors hand over a node's * whole text — a YAML block key, a Makefile recipe (`endif\n\n$(obj)/x.h`), a * ktest .conf directive — and the line break rode into the graph (2026-09-16 * probe: 8,301 Field nodes on elastic/elasticsearch, 91 kernel nodes). Cut at * the first line break and drop trailing blanks; the qualified name carries * the same t

Source from the content-addressed store, hash-verified

322 * the first line break and drop trailing blanks; the qualified name carries
323 * the same text as its last segment and is cut the same way. */
324static const char *cbm_first_line(CBMArena *a, const char *text) {
325 if (!text) {
326 return text;
327 }
328 const char *nl = strpbrk(text, "\r\n");
329 if (!nl) {
330 return text;
331 }
332 size_t n = (size_t)(nl - text);
333 while (n > 0 && (text[n - 1] == ' ' || text[n - 1] == '\t')) {
334 n--;
335 }
336 char *cut = (char *)cbm_arena_alloc(a, n + 1);
337 if (!cut) {
338 return text;
339 }
340 memcpy(cut, text, n);
341 cut[n] = '\0';
342 return cut;
343}
344
345/* JS/TS files: a definition named by a literal token is the walker naming a
346 * function or variable from an object key or a numeric pattern element —

Callers 1

cbm_defs_pushFunction · 0.85

Calls 1

cbm_arena_allocFunction · 0.70

Tested by

no test coverage detected