| 650 | } |
| 651 | |
| 652 | static 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 | |
| 678 | void cbm_ti_source_include_closure(const cbm_ti_source_t *s, bool *marked) { |
| 679 | if (!s || !marked || !s->finished) { |
no test coverage detected