Improve the Allocator interface to support returning Allocator_Error to allow for safer calls

Virtually all code (except for user-written custom allocators) should work as normal. Extra features will need to be added to make the current procedures support the `Allocator_Error` return value (akin to #optional_ok)
This commit is contained in:
gingerBill
2021-04-19 12:31:31 +01:00
parent a4d0092b16
commit f98c4d6837
13 changed files with 386 additions and 276 deletions
+2 -2
View File
@@ -173,8 +173,8 @@ __slice_resize :: proc(array_: ^$T/[]$E, new_count: int, allocator: Allocator, l
old_size := array.len*size_of(T);
new_size := new_count*size_of(T);
new_data := mem_resize(array.data, old_size, new_size, align_of(T), allocator, loc);
if new_data == nil {
new_data, err := mem_resize(array.data, old_size, new_size, align_of(T), allocator, loc);
if new_data == nil || err != nil {
return false;
}
array.data = new_data;