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

Function cross_file_edge_exists

tests/test_pipeline.c:1245–1277  ·  view source on GitHub ↗

True iff a CALLS edge exists from a node named src_name to a node named * tgt_name. Used to assert cross-file call resolution survives a reindex. */

Source from the content-addressed store, hash-verified

1243/* True iff a CALLS edge exists from a node named src_name to a node named
1244 * tgt_name. Used to assert cross-file call resolution survives a reindex. */
1245static bool cross_file_edge_exists(cbm_store_t *s, const char *project, const char *src_name,
1246 const char *tgt_name, const char *edge_type) {
1247 cbm_node_t *srcs = NULL;
1248 cbm_node_t *tgts = NULL;
1249 int sc = 0;
1250 int tc = 0;
1251 cbm_store_find_nodes_by_name(s, project, src_name, &srcs, &sc);
1252 cbm_store_find_nodes_by_name(s, project, tgt_name, &tgts, &tc);
1253 bool found = false;
1254 for (int i = 0; i < sc && !found; i++) {
1255 cbm_edge_t *edges = NULL;
1256 int ec = 0;
1257 cbm_store_find_edges_by_source_type(s, srcs[i].id, edge_type, &edges, &ec);
1258 for (int j = 0; j < ec && !found; j++) {
1259 for (int k = 0; k < tc; k++) {
1260 if (edges[j].target_id == tgts[k].id) {
1261 found = true;
1262 break;
1263 }
1264 }
1265 }
1266 if (edges) {
1267 cbm_store_free_edges(edges, ec);
1268 }
1269 }
1270 if (srcs) {
1271 cbm_store_free_nodes(srcs, sc);
1272 }
1273 if (tgts) {
1274 cbm_store_free_nodes(tgts, tc);
1275 }
1276 return found;
1277}
1278
1279static bool cross_file_call_exists(cbm_store_t *s, const char *project, const char *src_name,
1280 const char *tgt_name) {

Callers 2

cross_file_call_existsFunction · 0.85
test_pipeline.cFile · 0.85

Calls 4

cbm_store_free_edgesFunction · 0.85
cbm_store_free_nodesFunction · 0.85

Tested by

no test coverage detected