aboutsummaryrefslogtreecommitdiff
path: root/src/array.c
diff options
context:
space:
mode:
authorZac Pierson <zacpiersonhehe@gmail.com>2017-03-21 14:16:42 -0500
committerZac Pierson <zacpiersonhehe@gmail.com>2017-03-21 14:16:42 -0500
commitc7bb861d3ca19f1a81043b8ad1e014ad10aa225f (patch)
tree56719cc445ebe06b4d2e486e2da3c17c57e216c2 /src/array.c
parentd890731716ea96fd69d7543c7d7225702cbd7268 (diff)
parent188b290dd50664aa8a89955ac2ab7dbebf7a653d (diff)
Merge https://github.com/gingerBill/Odin
"Fixed" a proc overload bug. Still needs a *real* fix.
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;
}