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
+9 -3
View File
@@ -755,9 +755,15 @@ access :: proc(path: string, mask: int) -> (bool, Errno) {
return true, ERROR_NONE
}
heap_alloc :: proc(size: int) -> rawptr {
assert(size >= 0)
return _unix_calloc(1, c.size_t(size))
heap_alloc :: proc(size: int, zero_memory := true) -> rawptr {
if size <= 0 {
return nil
}
if zero_memory {
return _unix_calloc(1, c.size_t(size))
} else {
return _unix_malloc(c.size_t(size))
}
}
heap_resize :: proc(ptr: rawptr, new_size: int) -> rawptr {