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

Function snapshot_entry

src/discover/userconfig.c:607–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605}
606
607static cbm_userconfig_snapshot_status_t snapshot_entry(CBMArena *arena, cbm_userconfig_t *cfg,
608 yyjson_val *key, yyjson_val *value) {
609 if (!snapshot_string(key) || !snapshot_string(value) || yyjson_get_str(key)[0] != '.')
610 return CBM_USERCONFIG_SNAPSHOT_INVALID;
611 const char *ext = yyjson_get_str(key);
612 for (int i = 0; i < cfg->count; i++) {
613 if (strcmp(cfg->entries[i].ext, ext) == 0)
614 return CBM_USERCONFIG_SNAPSHOT_INVALID;
615 }
616 CBMLanguage language = snapshot_language(value);
617 if (language == CBM_LANG_COUNT)
618 return CBM_USERCONFIG_SNAPSHOT_UNSUPPORTED;
619 char *copy = cbm_arena_strndup(arena, ext, yyjson_get_len(key));
620 if (!copy)
621 return CBM_USERCONFIG_SNAPSHOT_OOM;
622 cfg->entries[cfg->count++] = (cbm_userext_t){.ext = copy, .lang = language};
623 return CBM_USERCONFIG_SNAPSHOT_OK;
624}
625
626static cbm_userconfig_snapshot_status_t snapshot_parse(CBMArena *arena, cbm_userconfig_t *cfg) {
627 cbm_userconfig_source_t *source = cfg->project_source;

Callers 1

snapshot_parseFunction · 0.85

Calls 3

snapshot_stringFunction · 0.85
snapshot_languageFunction · 0.85
cbm_arena_strndupFunction · 0.50

Tested by

no test coverage detected