aboutsummaryrefslogtreecommitdiff
path: root/core/runtime/default_allocators_wasi.odin
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-11-04 11:03:21 +0000
committergingerBill <bill@gingerbill.org>2021-11-04 11:03:21 +0000
commit3fa7dabaa87e99386e469bd5e4badab23f89aaef (patch)
tree84933a742d8246b97ec862142ec9579319510bf7 /core/runtime/default_allocators_wasi.odin
parent1980f32bd6636edf7f8a1ba0d0010f23b5292488 (diff)
Correctly support `-default-to-nil-allocator` for all platforms
Diffstat (limited to 'core/runtime/default_allocators_wasi.odin')
-rw-r--r--core/runtime/default_allocators_wasi.odin31
1 files changed, 2 insertions, 29 deletions
diff --git a/core/runtime/default_allocators_wasi.odin b/core/runtime/default_allocators_wasi.odin
index e2bb7516e..2e475e055 100644
--- a/core/runtime/default_allocators_wasi.odin
+++ b/core/runtime/default_allocators_wasi.odin
@@ -1,32 +1,5 @@
//+build wasi
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) {
- switch mode {
- case .Alloc:
- return nil, .Out_Of_Memory
- case .Free:
- return nil, .None
- case .Free_All:
- return nil, .Mode_Not_Implemented
- case .Resize:
- if size == 0 {
- return nil, .None
- }
- return nil, .Out_Of_Memory
- case .Query_Features:
- return nil, .Mode_Not_Implemented
- case .Query_Info:
- return nil, .Mode_Not_Implemented
- }
- return nil, .None
-}
-
-default_allocator :: proc() -> Allocator {
- return Allocator{
- procedure = default_allocator_proc,
- data = nil,
- }
-}
+default_allocator_proc :: nil_allocator_proc
+default_allocator :: nil_allocator