| 727 | } |
| 728 | |
| 729 | static int agent_json_scan_string(agent_json_scanner_t *scanner, size_t *start_out, |
| 730 | size_t *end_out) { |
| 731 | if (scanner->position >= scanner->length || |
| 732 | (scanner->data[scanner->position] != '"' && scanner->data[scanner->position] != '\'')) { |
| 733 | return -1; |
| 734 | } |
| 735 | char quote = scanner->data[scanner->position++]; |
| 736 | size_t start = scanner->position; |
| 737 | bool escaped = false; |
| 738 | while (scanner->position < scanner->length) { |
| 739 | char current = scanner->data[scanner->position++]; |
| 740 | if (escaped) { |
| 741 | escaped = false; |
| 742 | } else if (current == '\\') { |
| 743 | escaped = true; |
| 744 | } else if (current == quote) { |
| 745 | if (start_out) { |
| 746 | *start_out = start; |
| 747 | } |
| 748 | if (end_out) { |
| 749 | *end_out = scanner->position - 1U; |
| 750 | } |
| 751 | return 0; |
| 752 | } else if ((unsigned char)current < 0x20U) { |
| 753 | return -1; |
| 754 | } |
| 755 | } |
| 756 | return -1; |
| 757 | } |
| 758 | |
| 759 | static int agent_json_scan_value(agent_json_scanner_t *scanner, unsigned depth); |
| 760 |
no outgoing calls
no test coverage detected