Add Allocator_Mode.Alloc_Non_Zerored

This commit is contained in:
gingerBill
2022-09-22 12:12:57 +01:00
parent eb0d7465e2
commit 7f601c9535
21 changed files with 128 additions and 65 deletions
+3 -3
View File
@@ -10,8 +10,8 @@ when ODIN_DEFAULT_TO_NIL_ALLOCATOR {
size, alignment: int,
old_memory: rawptr, old_size: int, loc := #caller_location) -> (data: []byte, err: Allocator_Error) {
switch mode {
case .Alloc:
data, err = _windows_default_alloc(size, alignment)
case .Alloc, .Alloc_Non_Zeroed:
data, err = _windows_default_alloc(size, alignment, mode == .Alloc)
case .Free:
_windows_default_free(old_memory)
@@ -25,7 +25,7 @@ when ODIN_DEFAULT_TO_NIL_ALLOCATOR {
case .Query_Features:
set := (^Allocator_Mode_Set)(old_memory)
if set != nil {
set^ = {.Alloc, .Free, .Resize, .Query_Features}
set^ = {.Alloc, .Alloc_Non_Zeroed, .Free, .Resize, .Query_Features}
}
case .Query_Info: