Parse a boolean "key":true/false from a flat JSON object. */
| 63 | |
| 64 | /* Parse a boolean "key":true/false from a flat JSON object. */ |
| 65 | static bool json_get_bool(const char *json, const char *key) { |
| 66 | if (!json) { |
| 67 | return false; |
| 68 | } |
| 69 | char pat[CBM_SZ_64]; |
| 70 | snprintf(pat, sizeof(pat), "\"%s\":", key); |
| 71 | const char *p = strstr(json, pat); |
| 72 | if (!p) { |
| 73 | return false; |
| 74 | } |
| 75 | p += strlen(pat); |
| 76 | while (*p == ' ' || *p == '\t') { |
| 77 | p++; |
| 78 | } |
| 79 | return *p == 't'; |
| 80 | } |
| 81 | |
| 82 | /* Append transitive_loop_depth + recursive to a node's properties JSON object. */ |
| 83 | static void append_complexity_props(cbm_gbuf_node_t *node, int tld, bool recursive) { |