aboutsummaryrefslogtreecommitdiff
path: root/src/array.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-01-10 14:50:28 +0000
committergingerBill <bill@gingerbill.org>2022-01-10 14:50:28 +0000
commit7cc265e14ce3ec08a5908d31441000bdcb4ac645 (patch)
tree690cd607687a3879acaabe48d072dc5f358c59d4 /src/array.cpp
parent6f3e450c502a8d05653ffcd98c74e2e933a34d1d (diff)
Add mutex guards for signature scopes
Diffstat (limited to 'src/array.cpp')
-rw-r--r--src/array.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/array.cpp b/src/array.cpp
index c41125c6d..ac3727978 100644
--- a/src/array.cpp
+++ b/src/array.cpp
@@ -77,15 +77,19 @@ template <typename T> Slice<T> slice_from_array(Array<T> const &a);
template <typename T>
Slice<T> slice_make(gbAllocator const &allocator, isize count) {
+ GB_ASSERT(count >= 0);
Slice<T> s = {};
s.data = gb_alloc_array(allocator, T, count);
+ GB_ASSERT(s.data != nullptr);
s.count = count;
return s;
}
template <typename T>
void slice_init(Slice<T> *s, gbAllocator const &allocator, isize count) {
+ GB_ASSERT(count >= 0);
s->data = gb_alloc_array(allocator, T, count);
+ GB_ASSERT(s->data != nullptr);
s->count = count;
}