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

Function op_index_span

src/pipeline/pass_operator.c:119–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117} op_index_ctx_t;
118
119static void op_index_span(const char *file, int start, int end, void *ud) {
120 op_index_ctx_t *c = ud;
121 op_spans_t *v = cbm_ht_get(c->by_file, file);
122 if (!v) {
123 v = cbm_calloc(CBM_MEM_CLASS_OTHER, sizeof(*v));
124 char *key = cbm_mem_strdup(CBM_MEM_CLASS_OTHER, file);
125 if (!v || !key) {
126 cbm_free(CBM_MEM_CLASS_OTHER, v);
127 cbm_free(CBM_MEM_CLASS_OTHER, key);
128 return;
129 }
130 cbm_ht_set(c->by_file, key, v);
131 }
132 op_spans_push(v, (op_span_t){c->node, start, end});
133}
134
135/* file_path -> the spans of Function and Method nodes in it (owned keys). */
136static CBMHashTable *op_functions_by_file(const cbm_gbuf_t *gb) {

Callers

nothing calls this directly

Calls 6

cbm_ht_getFunction · 0.85
cbm_callocFunction · 0.85
cbm_mem_strdupFunction · 0.85
cbm_freeFunction · 0.85
cbm_ht_setFunction · 0.85
op_spans_pushFunction · 0.85

Tested by

no test coverage detected