Skip to content

Instantly share code, notes, and snippets.

@holmeshe
Created September 20, 2018 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holmeshe/000339099a3fadecba94b524e4851225 to your computer and use it in GitHub Desktop.
Save holmeshe/000339099a3fadecba94b524e4851225 to your computer and use it in GitHub Desktop.
static int grow_slab_list (const unsigned int id) {
slabclass_t *p = &slabclass[id];
if (p->slabs == p->list_size) {
size_t new_size = (p->list_size != 0) ? p->list_size * 2 : 16;
void *new_list = realloc(p->slab_list, new_size * sizeof(void *));
if (new_list == 0) return 0;
p->list_size = new_size;
p->slab_list = new_list;
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment