mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-21 22:05:20 +00:00
Aid code generation on non-release builds
This commit is contained in:
@@ -3,10 +3,10 @@ package runtime
|
||||
|
||||
default_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr, old_size: int, loc := #caller_location) -> ([]byte, Allocator_Error) {
|
||||
old_memory: rawptr, old_size: int, loc := #caller_location) -> (data: []byte, err: Allocator_Error) {
|
||||
switch mode {
|
||||
case .Alloc:
|
||||
return _windows_default_alloc(size, alignment);
|
||||
data, err = _windows_default_alloc(size, alignment);
|
||||
|
||||
case .Free:
|
||||
_windows_default_free(old_memory);
|
||||
@@ -15,20 +15,19 @@ default_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||
// NOTE(tetra): Do nothing.
|
||||
|
||||
case .Resize:
|
||||
return _windows_default_resize(old_memory, old_size, size, alignment);
|
||||
data, err = _windows_default_resize(old_memory, old_size, size, alignment);
|
||||
|
||||
case .Query_Features:
|
||||
set := (^Allocator_Mode_Set)(old_memory);
|
||||
if set != nil {
|
||||
set^ = {.Alloc, .Free, .Resize, .Query_Features};
|
||||
}
|
||||
return nil, nil;
|
||||
|
||||
case .Query_Info:
|
||||
return nil, nil;
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
return nil, nil;
|
||||
return;
|
||||
}
|
||||
|
||||
default_allocator :: proc() -> Allocator {
|
||||
|
||||
Reference in New Issue
Block a user