aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lilley <ianlilleyt@gmail.com>2022-06-01 22:40:39 -0400
committerIan Lilley <ianlilleyt@gmail.com>2022-06-01 22:40:39 -0400
commitdda2ed290a75aec31b83d45b770b6588d4be89b7 (patch)
tree16083632958eedbb492869cd8a22f3a5ab7c4c7d
parentba5f7c4e2af5c82c220b7e1796fde2f026ce4208 (diff)
tidying up Query_Info return value when not in query features
-rw-r--r--core/mem/allocators.odin9
-rw-r--r--core/os/os2/heap_windows.odin2
-rw-r--r--core/runtime/default_allocators_windows.odin4
-rw-r--r--core/runtime/default_temporary_allocator.odin2
4 files changed, 8 insertions, 9 deletions
diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin
index d006e4574..fb9f7aa3b 100644
--- a/core/mem/allocators.odin
+++ b/core/mem/allocators.odin
@@ -886,6 +886,10 @@ tracking_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
}
case .Free:
delete_key(&data.allocation_map, old_memory)
+ case .Free_All:
+ if data.clear_on_free_all {
+ clear_map(&data.allocation_map)
+ }
case .Resize:
if old_memory != result_ptr {
delete_key(&data.allocation_map, old_memory)
@@ -898,11 +902,6 @@ tracking_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
location = loc,
}
- case .Free_All:
- if data.clear_on_free_all {
- clear_map(&data.allocation_map)
- }
-
case .Query_Features:
set := (^Allocator_Mode_Set)(old_memory)
if set != nil {
diff --git a/core/os/os2/heap_windows.odin b/core/os/os2/heap_windows.odin
index 85ea2c56f..90f0ae110 100644
--- a/core/os/os2/heap_windows.odin
+++ b/core/os/os2/heap_windows.odin
@@ -99,7 +99,7 @@ _heap_allocator_proc :: proc(allocator_data: rawptr, mode: mem.Allocator_Mode,
return nil, nil
case .Query_Info:
- return nil, nil
+ return nil, .Mode_Not_Implemented
}
return nil, nil
diff --git a/core/runtime/default_allocators_windows.odin b/core/runtime/default_allocators_windows.odin
index 9cabbcce8..45d4d3e6a 100644
--- a/core/runtime/default_allocators_windows.odin
+++ b/core/runtime/default_allocators_windows.odin
@@ -17,7 +17,7 @@ when ODIN_DEFAULT_TO_NIL_ALLOCATOR {
_windows_default_free(old_memory)
case .Free_All:
- // NOTE(tetra): Do nothing.
+ return nil, .Mode_Not_Implemented
case .Resize:
data, err = _windows_default_resize(old_memory, old_size, size, alignment)
@@ -29,7 +29,7 @@ when ODIN_DEFAULT_TO_NIL_ALLOCATOR {
}
case .Query_Info:
- // Do nothing
+ return nil, .Mode_Not_Implemented
}
return
diff --git a/core/runtime/default_temporary_allocator.odin b/core/runtime/default_temporary_allocator.odin
index 4337e555b..52f781980 100644
--- a/core/runtime/default_temporary_allocator.odin
+++ b/core/runtime/default_temporary_allocator.odin
@@ -185,7 +185,7 @@ when ODIN_OS == .Freestanding || ODIN_OS == .JS || ODIN_DEFAULT_TO_NIL_ALLOCATOR
}
case .Query_Info:
- // Nothing to give
+ return nil, .Mode_Not_Implemented
}
return