Skip to content

Commit

Permalink
Make list growth exponential
Browse files Browse the repository at this point in the history
  • Loading branch information
Noam Preil committed Nov 26, 2020
1 parent 8f2a76f commit 454bc3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ list_t *create_list(void) {

static void list_resize(list_t *list) {
if (list->length == list->capacity) {
list->capacity += 10;
list->capacity = list->capacity * 2 + 8;
list->items = realloc(list->items, sizeof(void*) * list->capacity);
}
}
Expand Down

0 comments on commit 454bc3d

Please sign in to comment.