| 859 | } |
| 860 | |
| 861 | static int agent_json_scan_value(agent_json_scanner_t *scanner, unsigned depth) { |
| 862 | if (depth > AGENT_JSON_MAX_DEPTH || agent_json_skip_space(scanner) != 0 || |
| 863 | scanner->position >= scanner->length) { |
| 864 | return -1; |
| 865 | } |
| 866 | char first = scanner->data[scanner->position]; |
| 867 | if (first == '{') { |
| 868 | return agent_json_scan_object(scanner, depth); |
| 869 | } |
| 870 | if (first == '[') { |
| 871 | return agent_json_scan_array(scanner, depth); |
| 872 | } |
| 873 | if (first == '"' || first == '\'') { |
| 874 | return agent_json_scan_string(scanner, NULL, NULL); |
| 875 | } |
| 876 | size_t start = scanner->position; |
| 877 | while (scanner->position < scanner->length && |
| 878 | !isspace((unsigned char)scanner->data[scanner->position]) && |
| 879 | !strchr(",]}", scanner->data[scanner->position])) { |
| 880 | scanner->position++; |
| 881 | } |
| 882 | return scanner->position > start ? 0 : -1; |
| 883 | } |
| 884 | |
| 885 | static bool agent_json_key_equals(const char *data, size_t start, size_t end, const char *key) { |
| 886 | if (end < start) { |
no test coverage detected