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

Function lrp_index

tests/test_lsp_resolution_probe.c:143–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static cbm_store_t *lrp_index(LRP_Proj *lp, const LRP_File *files, int nfiles) {
144 memset(lp, 0, sizeof(*lp));
145 snprintf(lp->tmpdir, sizeof(lp->tmpdir), "/tmp/cbm_lrp_XXXXXX");
146 if (!cbm_mkdtemp(lp->tmpdir)) return NULL;
147 lrp_to_fwd_slashes(lp->tmpdir);
148 for (int i = 0; i < nfiles; i++) {
149 char path[700];
150 snprintf(path, sizeof(path), "%s/%s", lp->tmpdir, files[i].name);
151 char *slash = strrchr(path, '/');
152 if (slash && slash > path + strlen(lp->tmpdir)) {
153 *slash = '\0';
154 cbm_mkdir_p(path, 0755);
155 *slash = '/';
156 }
157 FILE *f = fopen(path, "wb");
158 if (!f) return NULL;
159 fputs(files[i].content, f);
160 fclose(f);
161 }
162 return lrp_open_indexed(lp);
163}
164
165static void lrp_cleanup(LRP_Proj *lp, cbm_store_t *store) {
166 if (store) cbm_store_close(store);

Callers 3

lrp_usageFunction · 0.85
lrp_assert_callsFunction · 0.85

Calls 4

cbm_mkdtempFunction · 0.85
lrp_to_fwd_slashesFunction · 0.85
cbm_mkdir_pFunction · 0.85
lrp_open_indexedFunction · 0.85

Tested by

no test coverage detected