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

Function extract_json_string_prop

src/store/store.c:8986–9007  ·  view source on GitHub ↗

Extract a JSON string value from a simple JSON object by key name. */

Source from the content-addressed store, hash-verified

8984
8985/* Extract a JSON string value from a simple JSON object by key name. */
8986static char *extract_json_string_prop(const char *json, const char *key, int key_len) {
8987 if (!json) {
8988 return NULL;
8989 }
8990 const char *m = strstr(json, key);
8991 if (!m) {
8992 return NULL;
8993 }
8994 m = strchr(m + key_len, '"');
8995 if (!m) {
8996 return NULL;
8997 }
8998 m++;
8999 const char *end = strchr(m, '"');
9000 if (!end || end - m >= CBM_SZ_256) {
9001 return NULL;
9002 }
9003 char vbuf[CBM_SZ_256];
9004 memcpy(vbuf, m, end - m);
9005 vbuf[end - m] = '\0';
9006 return heap_strdup(vbuf);
9007}
9008
9009static int arch_routes(cbm_store_t *s, const char *project, const char *path,
9010 cbm_architecture_info_t *out) {

Callers 1

arch_routesFunction · 0.85

Calls 1

heap_strdupFunction · 0.70

Tested by

no test coverage detected