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

Function jl_validate_document

src/cli/config_json_like.c:615–631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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