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

Function sanitize_expr

src/pipeline/pass_parallel.c:2127–2145  ·  view source on GitHub ↗

Append arg data as JSON to edge properties: ,"args":[{"i":0,"e":"x","v":"val"},...] * Returns new position in buffer. */ Sanitize expression string for JSON (in-place). */

Source from the content-addressed store, hash-verified

2125 * Returns new position in buffer. */
2126/* Sanitize expression string for JSON (in-place). */
2127static void sanitize_expr(char *expr_buf, const char *expr) {
2128 if (expr) {
2129 snprintf(expr_buf, 128, "%.*s", 120, expr);
2130 /* The 120-byte cut can land inside a multibyte character; a torn
2131 * sequence persisted as invalid UTF-8 in edge properties (2026-09-16
2132 * probe: rust, java, typescript stores). */
2133 cbm_utf8_trim_partial(expr_buf);
2134 for (char *p = expr_buf; *p; p++) {
2135 if (*p == '"') {
2136 *p = '\'';
2137 }
2138 if (*p == '\n' || *p == '\r') {
2139 *p = ' ';
2140 }
2141 }
2142 } else {
2143 expr_buf[0] = '\0';
2144 }
2145}
2146
2147/* Format one call arg as JSON. Returns snprintf result. */
2148static int format_call_arg(char *buf, size_t bufsize, const CBMCallArg *a, const char *expr) {

Callers 1

append_args_jsonFunction · 0.85

Calls 1

cbm_utf8_trim_partialFunction · 0.85

Tested by

no test coverage detected