| 179 | } |
| 180 | |
| 181 | static bool tld_graph_alloc(tld_graph_t *g, int64_t maxid, int seed_cap, int edge_count) { |
| 182 | size_t sz = (size_t)maxid + 1; |
| 183 | g->maxid = maxid; |
| 184 | g->keys = cbm_calloc(CBM_MEM_CLASS_OTHER, sz * sizeof(*g->keys)); |
| 185 | g->present = cbm_calloc(CBM_MEM_CLASS_OTHER, sz * sizeof(*g->present)); |
| 186 | g->loop_depth = cbm_calloc(CBM_MEM_CLASS_OTHER, sz * sizeof(*g->loop_depth)); |
| 187 | g->recursive = cbm_calloc(CBM_MEM_CLASS_OTHER, sz * sizeof(*g->recursive)); |
| 188 | g->seeds = cbm_calloc(CBM_MEM_CLASS_OTHER, ((size_t)seed_cap + 1) * sizeof(*g->seeds)); |
| 189 | g->first = cbm_calloc(CBM_MEM_CLASS_OTHER, (sz + 1) * sizeof(*g->first)); |
| 190 | g->callee = cbm_calloc(CBM_MEM_CLASS_OTHER, ((size_t)edge_count + 1) * sizeof(*g->callee)); |
| 191 | return g->keys && g->present && g->loop_depth && g->recursive && g->seeds && g->first && |
| 192 | g->callee; |
| 193 | } |
| 194 | |
| 195 | /* Sources must be counted into first[src + 1] before this; turns the counts |
| 196 | * into offsets. */ |
no test coverage detected