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

Function ti_build_includes

src/mcp/test_impact_source.c:652–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

650}
651
652static bool ti_build_includes(cbm_ti_source_t *s) {
653 CBMHashTable *suffixes = cbm_ht_create_in(CBM_MEM_CLASS_EXTRACT, 0);
654 ti_ints_t *lists = NULL;
655 int list_count = 0;
656 int list_cap = 0;
657 bool ok = suffixes && ti_add_suffixes(s, suffixes, &lists, &list_count, &list_cap);
658 for (int f = 0; ok && f < s->file_count; f++) {
659 for (int line = 1; ok && line <= s->files[f].line_count; line++) {
660 size_t len = 0;
661 const char *text = cbm_ti_source_line(s, f, line, &len);
662 cbm_ti_span_t inc;
663 if (cbm_ti_match_include(text, len, &inc)) {
664 ok = ti_resolve_include(s, suffixes, lists, f, text + inc.start, inc.len);
665 }
666 }
667 }
668 for (int i = 0; i < list_count; i++) {
669 cbm_free(CBM_MEM_CLASS_EXTRACT, lists[i].items);
670 }
671 cbm_free(CBM_MEM_CLASS_EXTRACT, lists);
672 if (suffixes) {
673 cbm_ht_free(suffixes);
674 }
675 return ok;
676}
677
678void cbm_ti_source_include_closure(const cbm_ti_source_t *s, bool *marked) {
679 if (!s || !marked || !s->finished) {

Callers 1

cbm_ti_source_finishFunction · 0.85

Calls 7

cbm_ht_create_inFunction · 0.85
ti_add_suffixesFunction · 0.85
cbm_ti_source_lineFunction · 0.85
cbm_ti_match_includeFunction · 0.85
ti_resolve_includeFunction · 0.85
cbm_freeFunction · 0.85
cbm_ht_freeFunction · 0.85

Tested by

no test coverage detected