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

Function resolve_store_fallback_scan

src/mcp/mcp.c:2672–2701  ·  view source on GitHub ↗

resolve_store_fallback_scan — see forward declaration above resolve_store. */

Source from the content-addressed store, hash-verified

2670
2671/* resolve_store_fallback_scan — see forward declaration above resolve_store. */
2672static cbm_store_t *resolve_store_fallback_scan(const char *project) {
2673 char dir_path[CBM_SZ_1K];
2674 cache_dir(dir_path, sizeof(dir_path));
2675 cbm_dir_t *d = cbm_opendir(dir_path);
2676 if (!d) {
2677 return NULL;
2678 }
2679 cbm_store_t *found = NULL;
2680 cbm_dirent_t *entry;
2681 while ((entry = cbm_readdir(d)) != NULL) {
2682 const char *n = entry->name;
2683 size_t len = strlen(n);
2684 if (!is_project_db_file(n, len)) {
2685 continue;
2686 }
2687 char full_path[CBM_SZ_2K];
2688 snprintf(full_path, sizeof(full_path), "%s/%s", dir_path, n);
2689 char iname[CBM_SZ_1K];
2690 cbm_store_t *st = NULL;
2691 if (db_internal_project_name(full_path, iname, sizeof(iname), &st)) {
2692 if (strcmp(iname, project) == 0) {
2693 found = st; /* adopt — caller takes ownership */
2694 break;
2695 }
2696 cbm_store_close(st);
2697 }
2698 }
2699 cbm_closedir(d);
2700 return found;
2701}
2702
2703typedef struct {
2704 char *name;

Callers 2

resolve_store_internalFunction · 0.85

Calls 7

cache_dirFunction · 0.85
cbm_opendirFunction · 0.85
cbm_readdirFunction · 0.85
is_project_db_fileFunction · 0.85
db_internal_project_nameFunction · 0.85
cbm_store_closeFunction · 0.85
cbm_closedirFunction · 0.85

Tested by

no test coverage detected