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

Function config_scalar_value

internal/cbm/extract_defs.c:10192–10206  ·  view source on GitHub ↗

Normalise a config scalar into an indexable value: drop a YAML block-scalar header (`|`/`>` plus its chomping and indent modifiers), collapse whitespace to the shared MAX_COMMENT_LEN cap, then unquote.

Source from the content-addressed store, hash-verified

10190// header (`|`/`>` plus its chomping and indent modifiers), collapse whitespace
10191// to the shared MAX_COMMENT_LEN cap, then unquote.
10192static const char *config_scalar_value(CBMArena *a, const char *raw) {
10193 if (!raw) {
10194 return NULL;
10195 }
10196 while (*raw == ' ' || *raw == '\t' || *raw == '\n' || *raw == '\r') {
10197 raw++;
10198 }
10199 if (*raw == '|' || *raw == '>') {
10200 while (*raw && *raw != '\n') {
10201 raw++;
10202 }
10203 }
10204 char *v = collapse_prose(a, raw, strlen(raw));
10205 return v ? strip_surrounding_quotes(v) : NULL;
10206}
10207
10208// Value of `pair` when its key is `want`, else NULL. A YAML block_mapping_pair
10209// and a JSON pair both expose key/value fields, so one reader serves both.

Callers 1

config_pair_value_if_keyFunction · 0.85

Calls 2

collapse_proseFunction · 0.85
strip_surrounding_quotesFunction · 0.85

Tested by

no test coverage detected