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

Function json_escaped_len

src/git/git_context.c:347–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345}
346
347static int json_escaped_len(const char *src) {
348 if (!src) {
349 return 0;
350 }
351 int len = 0;
352 for (int i = 0; src[i]; i++) {
353 unsigned char c = (unsigned char)src[i];
354 if (c == '"' || c == '\\' || c == '\n' || c == '\r' || c == '\t') {
355 len += 2;
356 } else if (c < 0x20) {
357 len += 6; /* \u00XX */
358 } else {
359 len++;
360 }
361 }
362 return len;
363}
364
365static bool json_append_bool(char *buf, int buf_size, int *off, const char *name, bool value,
366 bool comma) {

Callers 1

json_append_stringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected