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

Function calls_edge_between

tests/test_lang_contract.c:1429–1460  ·  view source on GitHub ↗

True if a CALLS edge exists whose source QN ends with `src_suffix` and * target QN ends with `tgt_suffix`. */

Source from the content-addressed store, hash-verified

1427/* True if a CALLS edge exists whose source QN ends with `src_suffix` and
1428 * target QN ends with `tgt_suffix`. */
1429static int calls_edge_between(cbm_store_t *store, const char *project, const char *src_suffix,
1430 const char *tgt_suffix) {
1431 cbm_edge_t *edges = NULL;
1432 int n = 0;
1433 if (cbm_store_find_edges_by_type(store, project, "CALLS", &edges, &n) != CBM_STORE_OK)
1434 return 0;
1435 int found = 0;
1436 size_t ssl = strlen(src_suffix);
1437 size_t tsl = strlen(tgt_suffix);
1438 for (int i = 0; i < n && !found; i++) {
1439 cbm_node_t s, t;
1440 if (cbm_store_find_node_by_id(store, edges[i].source_id, &s) != CBM_STORE_OK)
1441 continue;
1442 if (cbm_store_find_node_by_id(store, edges[i].target_id, &t) != CBM_STORE_OK) {
1443 cbm_node_free_fields(&s);
1444 continue;
1445 }
1446 const char *sq = s.qualified_name;
1447 const char *tq = t.qualified_name;
1448 if (sq && tq) {
1449 size_t sql = strlen(sq);
1450 size_t tql = strlen(tq);
1451 if (sql >= ssl && strcmp(sq + sql - ssl, src_suffix) == 0 && tql >= tsl &&
1452 strcmp(tq + tql - tsl, tgt_suffix) == 0)
1453 found = 1;
1454 }
1455 cbm_node_free_fields(&s);
1456 cbm_node_free_fields(&t);
1457 }
1458 cbm_store_free_edges(edges, n);
1459 return found;
1460}
1461
1462/* #999: URLs in CI/tooling configs (.pre-commit-config.yaml, .github/
1463 * workflows) are repository references for TOOLING, not endpoints this

Callers 1

Calls 4

cbm_node_free_fieldsFunction · 0.85
cbm_store_free_edgesFunction · 0.85

Tested by

no test coverage detected