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

Function ti_resolve_include

src/mcp/test_impact_source.c:625–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

623}
624
625static bool ti_resolve_include(cbm_ti_source_t *s, CBMHashTable *suffixes, const ti_ints_t *lists,
626 int from, const char *inc, size_t inc_len) {
627 char *normal = ti_normalize_join(&s->arena, s->files[from].path, inc, inc_len);
628 if (!normal) {
629 return false;
630 }
631 int direct = cbm_ti_source_find(s, normal);
632 if (direct >= 0) {
633 return ti_add_includer(s, direct, from);
634 }
635 size_t skip = 0;
636 while (skip < inc_len && (inc[skip] == '.' || inc[skip] == '/')) {
637 skip++;
638 }
639 char *key = cbm_arena_strndup(&s->arena, inc + skip, inc_len - skip);
640 if (!key) {
641 return false;
642 }
643 intptr_t at = (intptr_t)cbm_ht_get(suffixes, key);
644 for (int i = 0; at && i < lists[at - 1].count; i++) {
645 if (!ti_add_includer(s, lists[at - 1].items[i], from)) {
646 return false;
647 }
648 }
649 return true;
650}
651
652static bool ti_build_includes(cbm_ti_source_t *s) {
653 CBMHashTable *suffixes = cbm_ht_create_in(CBM_MEM_CLASS_EXTRACT, 0);

Callers 1

ti_build_includesFunction · 0.85

Calls 5

ti_normalize_joinFunction · 0.85
cbm_ti_source_findFunction · 0.85
ti_add_includerFunction · 0.85
cbm_ht_getFunction · 0.85
cbm_arena_strndupFunction · 0.50

Tested by

no test coverage detected