A Go file that mentions a chart: its loaders noted now; the file is read * again for its loader calls once every loader is known. A file importing * the SDK loader is marked: it is read again even when no loader of the * repository exists. */
| 1935 | * the SDK loader is marked: it is read again even when no loader of the |
| 1936 | * repository exists. */ |
| 1937 | static void gc_note(gc_t *g, const char *file, const char *text) { |
| 1938 | if (!strstr(text, "Chart") && !strstr(text, "chart/loader")) { |
| 1939 | return; |
| 1940 | } |
| 1941 | gc_summarize(g, file, text); |
| 1942 | bool sdk = strstr(text, GC_SDK_LOADER) != NULL; |
| 1943 | size_t fl = strlen(file); |
| 1944 | char *entry = cbm_alloc(CBM_MEM_CLASS_OTHER, fl + PAIR_LEN); /* flag + path */ |
| 1945 | if (!entry || !gc_grow((void **)&g->noted, &g->cap_noted, g->nnoted, sizeof(*g->noted))) { |
| 1946 | cbm_free(CBM_MEM_CLASS_OTHER, entry); |
| 1947 | return; |
| 1948 | } |
| 1949 | entry[0] = sdk ? GC_NOTED_SDK : GC_NOTED_PLAIN; |
| 1950 | memcpy(entry + SKIP_ONE, file, fl + SKIP_ONE); |
| 1951 | g->noted[g->nnoted++] = entry; |
| 1952 | } |
| 1953 | |
| 1954 | static int gc_run(gc_t *g) { |
| 1955 | if (g->nnoted == 0) { |
no test coverage detected