| 117 | } op_index_ctx_t; |
| 118 | |
| 119 | static 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). */ |
| 136 | static CBMHashTable *op_functions_by_file(const cbm_gbuf_t *gb) { |
nothing calls this directly
no test coverage detected