mirror of
https://github.com/ziglang/zig.git
synced 2025-12-24 07:03:11 +00:00
stage2: take advantage of the new WasmAllocator
This commit is contained in:
parent
3dcdd5544f
commit
8c1c67bdd0
@ -152,8 +152,14 @@ var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{
|
||||
pub fn main() anyerror!void {
|
||||
crash_report.initialize();
|
||||
|
||||
const use_gpa = build_options.force_gpa or !builtin.link_libc;
|
||||
const use_gpa = (build_options.force_gpa or !builtin.link_libc) and builtin.os.tag != .wasi;
|
||||
const gpa = gpa: {
|
||||
if (builtin.os.tag == .wasi) {
|
||||
break :gpa Allocator{
|
||||
.ptr = undefined,
|
||||
.vtable = &std.heap.WasmAllocator.vtable,
|
||||
};
|
||||
}
|
||||
if (use_gpa) {
|
||||
break :gpa general_purpose_allocator.allocator();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user