aboutsummaryrefslogtreecommitdiff
path: root/src/array.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-03-19 16:59:11 +0000
committerGinger Bill <bill@gingerbill.org>2017-03-19 16:59:11 +0000
commit5562364a98f01a0c0221a70345656d45de0d2009 (patch)
tree3ea4409ec3fcd1b7469c96d0e6ff03b437f8f823 /src/array.c
parent32150e401e39bd68f9882c3983829e744603dac1 (diff)
Add branch labels for loops; using list
Diffstat (limited to 'src/array.c')
-rw-r--r--src/array.c10
1 files changed, 2 insertions, 8 deletions
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;
}