Skip to content

Commit 454bc3d

Browse files
author
Noam Preil
committed
Make list growth exponential
1 parent 8f2a76f commit 454bc3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ list_t *create_list(void) {
1313

1414
static void list_resize(list_t *list) {
1515
if (list->length == list->capacity) {
16-
list->capacity += 10;
16+
list->capacity = list->capacity * 2 + 8;
1717
list->items = realloc(list->items, sizeof(void*) * list->capacity);
1818
}
1919
}

0 commit comments

Comments
 (0)