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

Function append_json_raw

src/pipeline/pass_parallel.c:487–500  ·  view source on GitHub ↗

Append an already-serialized JSON value verbatim: ,"key": . Atomic like * append_json_string. For `variants`, which extraction builds as a JSON array * of objects (cbm.h). Twin of pass_definitions.c -- keep both in sync. */

Source from the content-addressed store, hash-verified

485 * append_json_string. For `variants`, which extraction builds as a JSON array
486 * of objects (cbm.h). Twin of pass_definitions.c -- keep both in sync. */
487static void append_json_raw(char *buf, size_t bufsize, size_t *pos, const char *key,
488 const char *json) {
489 if (!json || json[0] == '\0') {
490 return;
491 }
492 size_t required = strlen(key) + strlen(json) + PP_JSON_FIELD_OVERHEAD;
493 if (*pos + required + PP_ESC_SPACE > bufsize) {
494 return; /* whole field would not fit — skip it atomically */
495 }
496 int w = snprintf(buf + *pos, bufsize - *pos, ",\"%s\":%s", key, json);
497 if (w > 0 && (size_t)w < bufsize - *pos) {
498 *pos += (size_t)w;
499 }
500}
501
502static void build_def_props(char *buf, size_t bufsize, const CBMDefinition *def) {
503 /* Complexity/loop/recursion metrics are meaningful only for Function/Method.

Callers 1

build_def_propsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected