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

Function jl_validate_entry

src/cli/config_json_like.c:634–657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);
636 if (length == 0 || length > JL_MAX_FILE_BYTES || jl_validate_utf8(entry_json, length) != 0) {
637 return -1;
638 }
639 jl_parser_t parser = {
640 .text = entry_json,
641 .length = length,
642 .pos = 0,
643 .strict = true,
644 };
645 if (jl_skip_trivia(&parser) != 0 || parser.pos >= parser.length) {
646 return -1;
647 }
648 size_t value_start = 0;
649 size_t value_end = 0;
650 if (jl_parse_value(&parser, 0, &value_start, &value_end) != 0 || jl_skip_trivia(&parser) != 0 ||
651 parser.pos != parser.length) {
652 return -1;
653 }
654 *start_out = value_start;
655 *length_out = value_end - value_start;
656 return 0;
657}
658
659static size_t jl_encode_utf8(uint32_t codepoint, unsigned char output[4]) {
660 if (codepoint <= 0x7FU) {

Callers 2

jl_upsert_entryFunction · 0.85

Calls 3

jl_validate_utf8Function · 0.85
jl_skip_triviaFunction · 0.85
jl_parse_valueFunction · 0.85

Tested by

no test coverage detected