Update builtin procedures to support the new allocator features (without breaking other code)

This commit is contained in:
gingerBill
2021-04-19 22:44:20 +01:00
parent 201cad51a9
commit c3b3194a00
8 changed files with 61 additions and 57 deletions
+4 -3
View File
@@ -31,9 +31,10 @@ Allocator_Query_Info :: struct {
Allocator_Error :: runtime.Allocator_Error;
/*
Allocator_Error :: enum byte {
None = 0,
Out_Of_Memory = 1,
Invalid_Pointer = 2,
None = 0,
Out_Of_Memory = 1,
Invalid_Pointer = 2,
Invalid_Argument = 3,
}
*/
Allocator_Proc :: runtime.Allocator_Proc;
+2 -2
View File
@@ -313,7 +313,7 @@ stack_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
s := cast(^Stack)allocator_data;
if s.data == nil {
return nil, .Out_Of_Memory;
return nil, .Invalid_Argument;
}
raw_alloc :: proc(s: ^Stack, size, alignment: int) -> ([]byte, Allocator_Error) {
@@ -468,7 +468,7 @@ small_stack_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
s := cast(^Small_Stack)allocator_data;
if s.data == nil {
return nil, .Out_Of_Memory;
return nil, .Invalid_Argument;
}
align := clamp(alignment, 1, 8*size_of(Stack_Allocation_Header{}.padding)/2);