| 44 | }; |
| 45 | |
| 46 | CBMInternPool *cbm_intern_create(void) { |
| 47 | CBMInternPool *p = (CBMInternPool *)calloc(CBM_ALLOC_ONE, sizeof(*p)); |
| 48 | if (!p) { |
| 49 | return NULL; |
| 50 | } |
| 51 | cbm_arena_init(&p->arena); |
| 52 | p->capacity = CBM_SZ_256; |
| 53 | p->mask = p->capacity - SKIP_ONE; |
| 54 | p->buckets = (InternEntry *)calloc(p->capacity, sizeof(InternEntry)); |
| 55 | if (!p->buckets) { |
| 56 | cbm_arena_destroy(&p->arena); |
| 57 | free(p); |
| 58 | return NULL; |
| 59 | } |
| 60 | return p; |
| 61 | } |
| 62 | |
| 63 | void cbm_intern_free(CBMInternPool *pool) { |
| 64 | if (!pool) { |
no test coverage detected