From 22315865696264aeef296364c7fc420b972a10fb Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 9 Aug 2015 19:27:25 -0400 Subject: Implement splith/splitv Ref #2 --- sway/list.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sway/list.c') diff --git a/sway/list.c b/sway/list.c index 82d6c144..55052f85 100644 --- a/sway/list.c +++ b/sway/list.c @@ -27,6 +27,14 @@ void list_add(list_t *list, void *item) { list->items[list->length++] = item; } +void list_insert(list_t *list, int index, void *item) { + if (list->length == list->capacity) { + list->capacity += 10; + list->items = realloc(list->items, sizeof(void*) * list->capacity); + } + list->items[list->length++] = item; +} + void list_del(list_t *list, int index) { list->length--; memmove(&list->items[index], &list->items[index + 1], sizeof(void*) * (list->capacity - index - 1)); -- cgit v1.2.3-54-g00ecf