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

Function lrp_index

tests/test_lsp_resolution_probe.c:152–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

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