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

Function adr_trailing_breaks

src/store/store.c:11413–11425  ·  view source on GitHub ↗

Trailing line breaks, counting a "\r\n" PAIR as ONE break. Counting raw '\n' * characters gets the count right but loses the shape, and the separator that * is then appended has to match the ending it is continuing. */

Source from the content-addressed store, hash-verified

11411 * characters gets the count right but loses the shape, and the separator that
11412 * is then appended has to match the ending it is continuing. */
11413static size_t adr_trailing_breaks(const char *doc, size_t doc_len) {
11414 size_t idx = doc_len;
11415 size_t breaks = 0;
11416 while (idx > 0 && (doc[idx - SKIP_ONE] == '\n' || doc[idx - SKIP_ONE] == '\r')) {
11417 bool was_lf = doc[idx - SKIP_ONE] == '\n';
11418 idx--;
11419 if (was_lf && idx > 0 && doc[idx - SKIP_ONE] == '\r') {
11420 idx--;
11421 }
11422 breaks++;
11423 }
11424 return breaks;
11425}
11426
11427char *cbm_adr_splice_section(const char *content, const char *name, const char *body) {
11428 if (!name || !body) {

Callers 1

cbm_adr_splice_sectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected