End of the section whose body starts at pos: the next header line outside * a multiline string, or len. */
| 1932 | /* End of the section whose body starts at pos: the next header line outside |
| 1933 | * a multiline string, or len. */ |
| 1934 | static int toml_section_end(const char *data, size_t pos, size_t len, size_t *end) { |
| 1935 | size_t cursor = pos; |
| 1936 | toml_line_t line; |
| 1937 | int multiline_state = TOML_STRING_NONE; |
| 1938 | while (toml_next_line(data, len, &cursor, &line)) { |
| 1939 | if (multiline_state == TOML_STRING_NONE) { |
| 1940 | toml_header_t header; |
| 1941 | if (toml_parse_header(data, &line, "", &header) != TOML_EDIT_OK) { |
| 1942 | return TOML_EDIT_ERR; |
| 1943 | } |
| 1944 | int present = header.present; |
| 1945 | toml_header_dispose(&header); |
| 1946 | if (present) { |
| 1947 | *end = line.start; |
| 1948 | return TOML_EDIT_OK; |
| 1949 | } |
| 1950 | } |
| 1951 | if (toml_scan_line_strings(data, &line, &multiline_state) != TOML_EDIT_OK) { |
| 1952 | return TOML_EDIT_ERR; |
| 1953 | } |
| 1954 | } |
| 1955 | *end = len; |
| 1956 | return multiline_state == TOML_STRING_NONE ? TOML_EDIT_OK : TOML_EDIT_ERR; |
| 1957 | } |
| 1958 | |
| 1959 | /* The section whose header line starts at pos. */ |
| 1960 | static int toml_section_at(const char *data, size_t pos, size_t len, toml_section_t *section) { |
no test coverage detected