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

Function jl_validate_document

src/cli/config_json_like.c:616–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614}
615
616static int jl_validate_document(const char *text, size_t length, size_t *root_out) {
617 if (jl_validate_utf8(text, length) != 0) {
618 return -1;
619 }
620 jl_parser_t parser = {.text = text, .length = length, .pos = 0, .strict = false};
621 if (jl_skip_trivia(&parser) != 0 || parser.pos >= parser.length ||
622 parser.text[parser.pos] != '{') {
623 return -1;
624 }
625 size_t root = parser.pos;
626 if (jl_parse_value(&parser, 0, NULL, NULL) != 0 || jl_skip_trivia(&parser) != 0 ||
627 parser.pos != parser.length) {
628 return -1;
629 }
630 *root_out = root;
631 return 0;
632}
633
634static int jl_validate_entry(const char *entry_json, size_t *start_out, size_t *length_out) {
635 size_t length = strlen(entry_json);

Calls 3

jl_validate_utf8Function · 0.85
jl_skip_triviaFunction · 0.85
jl_parse_valueFunction · 0.85

Tested by

no test coverage detected