Extract a JSON string value from a simple JSON object by key name. */
| 8984 | |
| 8985 | /* Extract a JSON string value from a simple JSON object by key name. */ |
| 8986 | static 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 | |
| 9009 | static int arch_routes(cbm_store_t *s, const char *project, const char *path, |
| 9010 | cbm_architecture_info_t *out) { |
no test coverage detected