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

Function gb_adopt_spans

src/graph_buffer/graph_buffer.c:1067–1086  ·  view source on GitHub ↗

A worker node copied into this buffer brings the spans it gathered there. */

Source from the content-addressed store, hash-verified

1065
1066/* A worker node copied into this buffer brings the spans it gathered there. */
1067static void gb_adopt_spans(cbm_gbuf_t *gb, const cbm_gbuf_node_t *node, const gb_span_vec_t *from) {
1068 if (!node || !node->qualified_name || !from || from->count == 0) {
1069 return;
1070 }
1071 if (!gb->variant_spans) {
1072 gb->variant_spans = cbm_ht_create_in(CBM_MEM_CLASS_GBUF_INDEX, 0);
1073 if (!gb->variant_spans) {
1074 return;
1075 }
1076 }
1077 gb_span_vec_t *vec = cbm_ht_get(gb->variant_spans, node->qualified_name);
1078 if (!vec) {
1079 vec = cbm_calloc(CBM_MEM_CLASS_GBUF_INDEX, sizeof(*vec));
1080 if (!vec) {
1081 return;
1082 }
1083 cbm_ht_set(gb->variant_spans, node->qualified_name, vec);
1084 }
1085 gb_append_spans(gb, vec, from);
1086}
1087
1088static void gb_span_vec_free(gb_span_vec_t *vec) {
1089 if (vec) {

Callers 1

cbm_gbuf_mergeFunction · 0.85

Calls 5

cbm_ht_create_inFunction · 0.85
cbm_ht_getFunction · 0.85
cbm_callocFunction · 0.85
cbm_ht_setFunction · 0.85
gb_append_spansFunction · 0.85

Tested by

no test coverage detected