sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit bd6a63966762f7fdcf5f9cd86bc50f7f0a9515e2
parent cf6edaf26aa1461b89552727d2435d6fe9d0adf3
Author: Ian Fan <ianfan0@gmail.com>
Date:   Thu,  6 Dec 2018 12:02:55 +0000

list: double list capacity when resizing instead of incrementing

This is the industry standard since it allows insertion to be amortized
O(1) time.

Diffstat:
Mcommon/list.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/list.c b/common/list.c @@ -17,7 +17,7 @@ list_t *create_list(void) { static void list_resize(list_t *list) { if (list->length == list->capacity) { - list->capacity += 10; + list->capacity *= 2; list->items = realloc(list->items, sizeof(void*) * list->capacity); } }