aboutsummaryrefslogtreecommitdiff
path: root/core/container/array.odin
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-10-01 17:04:56 +0100
committergingerBill <bill@gingerbill.org>2020-10-01 17:04:56 +0100
commit3a4f0d85a615111f3ceabd6e17b820337bf4198f (patch)
tree5b4148342617afde2dea54c06035dec21fe59355 /core/container/array.odin
parentc604e359c7d905e2d7f14b658dc6ac6e1ada2dbb (diff)
Fix container.Array and container.Ring
Diffstat (limited to 'core/container/array.odin')
-rw-r--r--core/container/array.odin7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/container/array.odin b/core/container/array.odin
index b422a2cf9..1f2cdc58c 100644
--- a/core/container/array.odin
+++ b/core/container/array.odin
@@ -10,6 +10,8 @@ Array :: struct(T: typeid) {
allocator: mem.Allocator,
}
+ARRAY_DEFAULT_CAPACITY :: 16;
+
/*
array_init :: proc {
array_init_none,
@@ -42,11 +44,12 @@ array_set_capacity
array_grow
*/
+
array_init_none :: proc(a: ^$A/Array, allocator := context.allocator) {
- array_init_len(a, 0, allocator);
+ array_init_len_cap(a, 0, ARRAY_DEFAULT_CAPACITY, allocator);
}
array_init_len :: proc(a: ^$A/Array, len: int, allocator := context.allocator) {
- array_init_len_cap(a, 0, 16, allocator);
+ array_init_len_cap(a, len, len, allocator);
}
array_init_len_cap :: proc(a: ^$A/Array($T), len: int, cap: int, allocator := context.allocator) {
a.allocator = allocator;