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

Function diagnostics_discovery_value

tests/test_diagnostics.c:328–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328static bool diagnostics_discovery_value(const char *key, char *out, size_t out_size) {
329 char marker[64];
330 if (snprintf(marker, sizeof(marker), "\"%s\":\"", key) >= (int)sizeof(marker)) {
331 return false;
332 }
333 const char *cursor = strstr(diagnostics_discovery_line, marker);
334 if (!cursor) {
335 return false;
336 }
337 cursor += strlen(marker);
338 size_t used = 0;
339 while (*cursor && *cursor != '"' && used + 1 < out_size) {
340 if (*cursor == '\\' && cursor[1] != '\0') {
341 cursor++;
342 char decoded = *cursor;
343 if (decoded == 'n') {
344 decoded = '\n';
345 } else if (decoded == 't') {
346 decoded = '\t';
347 } else if (decoded == 'r') {
348 decoded = '\r';
349 }
350 out[used++] = decoded;
351 cursor++;
352 continue;
353 }
354 out[used++] = *cursor++;
355 }
356 out[used] = '\0';
357 return *cursor == '"';
358}
359
360TEST(diagnostics_discovery_record_survives_suppressed_log_level) {
361 diagnostics_discovery_records = 0;

Callers 1

test_diagnostics.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected