use Allocator.allocSentinel now that the stage1 bug is fixed

Thanks @LemonBoy!
master
Andrew Kelley 2020-09-29 12:06:35 -07:00
parent 3efdd7b2ad
commit d8fa8b5455
6 changed files with 4 additions and 20 deletions

View File

@ -1,3 +0,0 @@
* wasi behavior tests failing
* go ahead and use allocSentinel now that the stage1 bug is fixed
* audit the base cache hash

View File

@ -231,8 +231,6 @@ fn AllocWithOptionsPayload(comptime Elem: type, comptime alignment: ?u29, compti
/// call `free` when done.
///
/// For allocating a single item, see `create`.
///
/// Deprecated; use `allocWithOptions`.
pub fn allocSentinel(
self: *Allocator,
comptime Elem: type,

View File

@ -1118,9 +1118,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void {
Compilation.dump_argv(argv.items);
}
const new_argv_with_sentinel = try arena.alloc(?[*:0]const u8, argv.items.len + 1);
new_argv_with_sentinel[argv.items.len] = null;
const new_argv = new_argv_with_sentinel[0..argv.items.len :null];
const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null);
for (argv.items) |arg, i| {
new_argv[i] = try arena.dupeZ(u8, arg);
}

View File

@ -1589,10 +1589,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
}
// Oh, snapplesauce! We need null terminated argv.
// TODO allocSentinel crashed stage1 so this is working around it.
const new_argv_with_sentinel = try arena.alloc(?[*:0]const u8, argv.items.len + 1);
new_argv_with_sentinel[argv.items.len] = null;
const new_argv = new_argv_with_sentinel[0..argv.items.len: null];
const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null);
for (argv.items) |arg, i| {
new_argv[i] = try arena.dupeZ(u8, arg);
}

View File

@ -567,10 +567,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
Compilation.dump_argv(argv.items);
}
// TODO allocSentinel crashed stage1 so this is working around it.
const new_argv_with_sentinel = try arena.alloc(?[*:0]const u8, argv.items.len + 1);
new_argv_with_sentinel[argv.items.len] = null;
const new_argv = new_argv_with_sentinel[0..argv.items.len :null];
const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null);
for (argv.items) |arg, i| {
new_argv[i] = try arena.dupeZ(u8, arg);
}

View File

@ -385,10 +385,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void {
Compilation.dump_argv(argv.items);
}
// TODO allocSentinel crashed stage1 so this is working around it.
const new_argv_with_sentinel = try arena.alloc(?[*:0]const u8, argv.items.len + 1);
new_argv_with_sentinel[argv.items.len] = null;
const new_argv = new_argv_with_sentinel[0..argv.items.len :null];
const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null);
for (argv.items) |arg, i| {
new_argv[i] = try arena.dupeZ(u8, arg);
}