mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-30 09:11:48 -07:00
Clean up organization of package runtime
This commit is contained in:
@@ -15,7 +15,46 @@ when ODIN_DEFAULT_TO_NIL_ALLOCATOR || ODIN_OS == "freestanding" {
|
||||
data = nil,
|
||||
};
|
||||
}
|
||||
} else when ODIN_OS != "windows" {
|
||||
|
||||
} else when ODIN_OS == "windows" {
|
||||
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) {
|
||||
switch mode {
|
||||
case .Alloc:
|
||||
return _windows_default_alloc(size, alignment);
|
||||
|
||||
case .Free:
|
||||
_windows_default_free(old_memory);
|
||||
|
||||
case .Free_All:
|
||||
// NOTE(tetra): Do nothing.
|
||||
|
||||
case .Resize:
|
||||
return _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;
|
||||
}
|
||||
|
||||
return nil, nil;
|
||||
}
|
||||
|
||||
default_allocator :: proc() -> Allocator {
|
||||
return Allocator{
|
||||
procedure = default_allocator_proc,
|
||||
data = nil,
|
||||
};
|
||||
}
|
||||
|
||||
} else {
|
||||
// TODO(bill): reimplement these procedures in the os_specific stuff
|
||||
import "core:os"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user