MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / toml_section_end

Function toml_section_end

src/cli/config_toml_edit.c:1934–1957  ·  view source on GitHub ↗

End of the section whose body starts at pos: the next header line outside * a multiline string, or len. */

Source from the content-addressed store, hash-verified

1932/* End of the section whose body starts at pos: the next header line outside
1933 * a multiline string, or len. */
1934static 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. */
1960static int toml_section_at(const char *data, size_t pos, size_t len, toml_section_t *section) {

Callers 2

toml_section_atFunction · 0.85
toml_managed_rewriteFunction · 0.85

Calls 4

toml_next_lineFunction · 0.85
toml_parse_headerFunction · 0.85
toml_header_disposeFunction · 0.85
toml_scan_line_stringsFunction · 0.85

Tested by

no test coverage detected