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

Function rp_edge_count

tests/repro/repro_reference_precision.c:58–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58static int rp_edge_count(cbm_store_t *store, const char *project, const char *edge_type,
59 const char *source_name, const char *target_label, const char *target_name,
60 const char *target_qn_suffix) {
61 cbm_edge_t *edges = NULL;
62 int edge_count = 0;
63 if (cbm_store_find_edges_by_type(store, project, edge_type, &edges, &edge_count) !=
64 CBM_STORE_OK) {
65 return -1;
66 }
67
68 int matches = 0;
69 for (int i = 0; i < edge_count; i++) {
70 cbm_node_t source = {0};
71 cbm_node_t target = {0};
72 int source_ok =
73 cbm_store_find_node_by_id(store, edges[i].source_id, &source) == CBM_STORE_OK;
74 int target_ok =
75 cbm_store_find_node_by_id(store, edges[i].target_id, &target) == CBM_STORE_OK;
76 if (source_ok && target_ok &&
77 (!source_name || (source.name && strcmp(source.name, source_name) == 0)) &&
78 (!target_label || (target.label && strcmp(target.label, target_label) == 0)) &&
79 (!target_name || (target.name && strcmp(target.name, target_name) == 0)) &&
80 (!target_qn_suffix || rp_qn_ends_with(target.qualified_name, target_qn_suffix))) {
81 matches++;
82 }
83 cbm_node_free_fields(&source);
84 cbm_node_free_fields(&target);
85 }
86 cbm_store_free_edges(edges, edge_count);
87 return matches;
88}
89
90static int rp_is_constructor_node(const cbm_node_t *node, const char *class_name) {
91 if (!node || !node->label || !node->name || !node->qualified_name || !class_name)

Calls 5

rp_qn_ends_withFunction · 0.85
cbm_node_free_fieldsFunction · 0.85
cbm_store_free_edgesFunction · 0.85

Tested by

no test coverage detected