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

Function jl_validate_entry

src/cli/config_json_like.c:633–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

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