From 5562364a98f01a0c0221a70345656d45de0d2009 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Sun, 19 Mar 2017 16:59:11 +0000 Subject: Add branch labels for loops; using list --- src/array.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/array.c') diff --git a/src/array.c b/src/array.c index d169a99ef..bb9e789db 100644 --- a/src/array.c +++ b/src/array.c @@ -87,14 +87,8 @@ void array__set_capacity(void *ptr, isize capacity, isize element_size) { x->count = capacity; } - { - // TODO(bill): Resize rather than copy and delete - void *new_data = gb_alloc(x->allocator, element_size*capacity); - gb_memmove(new_data, x->e, element_size*x->count); - gb_free(x->allocator, x->e); - x->capacity = capacity; - x->e = new_data; - } + x->e = gb_resize(x->allocator, x->e, element_size*x->capacity, element_size*capacity); + x->capacity = capacity; } -- cgit v1.2.3