aboutsummaryrefslogtreecommitdiff
path: root/core/runtime/default_allocators_nil.odin
diff options
context:
space:
mode:
Diffstat (limited to 'core/runtime/default_allocators_nil.odin')
-rw-r--r--core/runtime/default_allocators_nil.odin17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/runtime/default_allocators_nil.odin b/core/runtime/default_allocators_nil.odin
new file mode 100644
index 000000000..4e1d7a1d3
--- /dev/null
+++ b/core/runtime/default_allocators_nil.odin
@@ -0,0 +1,17 @@
+//+build freestanding, js
+package runtime
+
+// mem.nil_allocator reimplementation
+
+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) {
+ return nil, .None;
+}
+
+default_allocator :: proc() -> Allocator {
+ return Allocator{
+ procedure = default_allocator_proc,
+ data = nil,
+ };
+}