diff --git a/datatypes.c b/datatypes.c index 76e9da0..534ea3a 100644 --- a/datatypes.c +++ b/datatypes.c @@ -75,7 +75,8 @@ void * arlst_del(ArrayList *l, int id) { size_t new_size = l-> size + (l->capacity * (100 / D_SHRINK_THRESHOLD) * 100 / D_GROW_AMOUNT); - l->items = reallocarray(l->items, new_size, sizeof(void *)); +// l->items = reallocarray(l->items, new_size, sizeof(void *)); + l->items = realloc(l->items, new_size * sizeof(void *)); } return item; @@ -88,7 +89,8 @@ int arlst_add(ArrayList *l, void *item) { if (l->size == l->capacity) { size_t new_size = l->capacity + (100 / D_GROW_AMOUNT) * l->capacity; l->capacity = new_size; - l->items = (void **)reallocarray(l->items, new_size, sizeof(void *)); + //l->items = (void **)reallocarray(l->items, new_size, sizeof(void *)); + l->items = (void **)realloc(l->items, new_size * sizeof(void *)); } l->items[item_index] = item; diff --git a/datatypes.h b/datatypes.h index 8603acd..efb5ec2 100644 --- a/datatypes.h +++ b/datatypes.h @@ -1,5 +1,6 @@ #ifndef DTYPE_H #define DTYPE_H + #include enum {