| 742 | } |
| 743 | |
| 744 | static int agent_json_scan_string(agent_json_scanner_t *scanner, size_t *start_out, |
| 745 | size_t *end_out) { |
| 746 | if (scanner->position >= scanner->length || |
| 747 | (scanner->data[scanner->position] != '"' && scanner->data[scanner->position] != '\'')) { |
| 748 | return -1; |
| 749 | } |
| 750 | char quote = scanner->data[scanner->position++]; |
| 751 | size_t start = scanner->position; |
| 752 | bool escaped = false; |
| 753 | while (scanner->position < scanner->length) { |
| 754 | char current = scanner->data[scanner->position++]; |
| 755 | if (escaped) { |
| 756 | escaped = false; |
| 757 | } else if (current == '\\') { |
| 758 | escaped = true; |
| 759 | } else if (current == quote) { |
| 760 | if (start_out) { |
| 761 | *start_out = start; |
| 762 | } |
| 763 | if (end_out) { |
| 764 | *end_out = scanner->position - 1U; |
| 765 | } |
| 766 | return 0; |
| 767 | } else if ((unsigned char)current < 0x20U) { |
| 768 | return -1; |
| 769 | } |
| 770 | } |
| 771 | return -1; |
| 772 | } |
| 773 | |
| 774 | static int agent_json_scan_value(agent_json_scanner_t *scanner, unsigned depth); |
| 775 |
no outgoing calls
no test coverage detected