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

Function append_value_n

src/mcp/compact_out.c:311–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311static void append_value_n(cbm_sb_t *sb, const char *s, size_t len) {
312 if (!s || len == 0) {
313 cbm_sb_append_n(sb, "-", 1); /* stable column positions for empties */
314 return;
315 }
316 char *encoded = NULL;
317 size_t encoded_len = 0;
318 if (!cbm_output_encode_text(s, len, &encoded, &encoded_len)) {
319 sb->oom = true;
320 return;
321 }
322 const char *safe = encoded ? encoded : s;
323 size_t safe_len = encoded ? encoded_len : len;
324 if (needs_quotes_n(safe, safe_len)) {
325 append_quoted_n(sb, safe, safe_len);
326 } else {
327 cbm_sb_append_n(sb, safe, safe_len);
328 }
329 free(encoded);
330}
331
332static void append_value(cbm_sb_t *sb, const char *s) {
333 append_value_n(sb, s, s ? strlen(s) : 0);

Callers 2

append_valueFunction · 0.85
json_tree_scalarFunction · 0.85

Calls 4

cbm_sb_append_nFunction · 0.85
cbm_output_encode_textFunction · 0.85
needs_quotes_nFunction · 0.85
append_quoted_nFunction · 0.85

Tested by

no test coverage detected