mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-14 23:21:25 -07:00
Add mem.Allocator_Query_Info and mem.query_info
This commit is contained in:
+10
-4
@@ -234,6 +234,9 @@ args__: []cstring;
|
||||
|
||||
// IMPORTANT NOTE(bill): Must be in this order (as the compiler relies upon it)
|
||||
|
||||
@builtin
|
||||
Maybe :: union(T: typeid) #maybe {T};
|
||||
|
||||
|
||||
Source_Code_Location :: struct {
|
||||
file_path: string,
|
||||
@@ -252,10 +255,17 @@ Allocator_Mode :: enum byte {
|
||||
Free_All,
|
||||
Resize,
|
||||
Query_Features,
|
||||
Query_Info,
|
||||
}
|
||||
|
||||
Allocator_Mode_Set :: distinct bit_set[Allocator_Mode];
|
||||
|
||||
Allocator_Query_Info :: struct {
|
||||
pointer: rawptr,
|
||||
size: Maybe(int),
|
||||
alignment: Maybe(int),
|
||||
}
|
||||
|
||||
Allocator_Proc :: #type proc(allocator_data: rawptr, mode: Allocator_Mode,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr, old_size: int, flags: u64 = 0, location: Source_Code_Location = #caller_location) -> rawptr;
|
||||
@@ -310,10 +320,6 @@ Context :: struct {
|
||||
}
|
||||
|
||||
|
||||
@builtin
|
||||
Maybe :: union(T: typeid) #maybe {T};
|
||||
|
||||
|
||||
|
||||
@thread_local global_default_temp_allocator_data: Default_Temp_Allocator;
|
||||
|
||||
|
||||
@@ -139,6 +139,9 @@ default_temp_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode
|
||||
set^ = {.Alloc, .Free, .Free_All, .Resize, .Query_Features};
|
||||
}
|
||||
return set;
|
||||
|
||||
case .Query_Info:
|
||||
return nil;
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
||||
Reference in New Issue
Block a user