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

Function gc_run

src/pipeline/pass_operator.c:1954–1986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1952}
1953
1954static int gc_run(gc_t *g) {
1955 if (g->nnoted == 0) {
1956 return 0;
1957 }
1958 g->consts = cbm_ht_create(0);
1959 g->charts = gc_chart_index(g->ctx->gbuf);
1960 for (int i = 0; g->consts && g->charts && i < g->nnoted; i++) {
1961 const char *noted = g->noted[i];
1962 if (!noted || (g->nloaders == 0 && noted[0] != GC_NOTED_SDK)) {
1963 continue; /* no loader it could call */
1964 }
1965 const char *file = noted + SKIP_ONE;
1966 char path[CBM_SZ_4K];
1967 snprintf(path, sizeof(path), "%s/%s", g->ctx->repo_path, file);
1968 char *text = op_read_file(path);
1969 if (text) {
1970 gc_calls(g, file, text);
1971 cbm_free(CBM_MEM_CLASS_OTHER, text);
1972 }
1973 }
1974 if (g->charts) {
1975 gc_link_sites(g);
1976 }
1977 if (g->consts) {
1978 cbm_ht_foreach(g->consts, gc_free_consts, NULL);
1979 cbm_ht_free(g->consts);
1980 }
1981 if (g->charts) {
1982 cbm_ht_foreach(g->charts, gc_free_chart_list, NULL);
1983 cbm_ht_free(g->charts);
1984 }
1985 return g->edges;
1986}
1987
1988static void gc_free(gc_t *g) {
1989 for (int i = 0; i < g->nloaders; i++) {

Callers 1

Calls 8

cbm_ht_createFunction · 0.85
gc_chart_indexFunction · 0.85
op_read_fileFunction · 0.85
gc_callsFunction · 0.85
cbm_freeFunction · 0.85
gc_link_sitesFunction · 0.85
cbm_ht_foreachFunction · 0.85
cbm_ht_freeFunction · 0.85

Tested by

no test coverage detected