| author | |
| committer | |
| log | d8fa8b5455058d235793a8b9ecdf252fb8dd8782 |
| tree | 554f28740f2fae3c36e7ae507f850d55a026d455 |
| parent | 3efdd7b2ad6cce5985d761240636b3d5eb3b4c84 |
Thanks @LemonBoy!6 files changed, 4 insertions(+), 20 deletions(-)
BRANCH_TODO deleted-3| ... | @@ -1,3 +0,0 @@ | ||
| 1 | * wasi behavior tests failing | ||
| 2 | * go ahead and use allocSentinel now that the stage1 bug is fixed | ||
| 3 | * audit the base cache hash | ||
lib/std/mem/Allocator.zig-2| ... | @@ -231,8 +231,6 @@ fn AllocWithOptionsPayload(comptime Elem: type, comptime alignment: ?u29, compti | ... | @@ -231,8 +231,6 @@ fn AllocWithOptionsPayload(comptime Elem: type, comptime alignment: ?u29, compti |
| 231 | /// call `free` when done. | 231 | /// call `free` when done. |
| 232 | /// | 232 | /// |
| 233 | /// For allocating a single item, see `create`. | 233 | /// For allocating a single item, see `create`. |
| 234 | /// | ||
| 235 | /// Deprecated; use `allocWithOptions`. | ||
| 236 | pub fn allocSentinel( | 234 | pub fn allocSentinel( |
| 237 | self: *Allocator, | 235 | self: *Allocator, |
| 238 | comptime Elem: type, | 236 | comptime Elem: type, |
src/link/Coff.zig+1-3| ... | @@ -1118,9 +1118,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { | ... | @@ -1118,9 +1118,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void { |
| 1118 | Compilation.dump_argv(argv.items); | 1118 | Compilation.dump_argv(argv.items); |
| 1119 | } | 1119 | } |
| 1120 | 1120 | ||
| 1121 | const new_argv_with_sentinel = try arena.alloc(?[*:0]const u8, argv.items.len + 1); | 1121 | const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null); |
| 1122 | new_argv_with_sentinel[argv.items.len] = null; | ||
| 1123 | const new_argv = new_argv_with_sentinel[0..argv.items.len :null]; | ||
| 1124 | for (argv.items) |arg, i| { | 1122 | for (argv.items) |arg, i| { |
| 1125 | new_argv[i] = try arena.dupeZ(u8, arg); | 1123 | new_argv[i] = try arena.dupeZ(u8, arg); |
| 1126 | } | 1124 | } |
src/link/Elf.zig+1-4| ... | @@ -1589,10 +1589,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { | ... | @@ -1589,10 +1589,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void { |
| 1589 | } | 1589 | } |
| 1590 | 1590 | ||
| 1591 | // Oh, snapplesauce! We need null terminated argv. | 1591 | // Oh, snapplesauce! We need null terminated argv. |
| 1592 | // TODO allocSentinel crashed stage1 so this is working around it. | 1592 | const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null); |
| 1593 | const new_argv_with_sentinel = try arena.alloc(?[*:0]const u8, argv.items.len + 1); | ||
| 1594 | new_argv_with_sentinel[argv.items.len] = null; | ||
| 1595 | const new_argv = new_argv_with_sentinel[0..argv.items.len: null]; | ||
| 1596 | for (argv.items) |arg, i| { | 1593 | for (argv.items) |arg, i| { |
| 1597 | new_argv[i] = try arena.dupeZ(u8, arg); | 1594 | new_argv[i] = try arena.dupeZ(u8, arg); |
| 1598 | } | 1595 | } |
src/link/MachO.zig+1-4| ... | @@ -567,10 +567,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { | ... | @@ -567,10 +567,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void { |
| 567 | Compilation.dump_argv(argv.items); | 567 | Compilation.dump_argv(argv.items); |
| 568 | } | 568 | } |
| 569 | 569 | ||
| 570 | // TODO allocSentinel crashed stage1 so this is working around it. | 570 | const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null); |
| 571 | const new_argv_with_sentinel = try arena.alloc(?[*:0]const u8, argv.items.len + 1); | ||
| 572 | new_argv_with_sentinel[argv.items.len] = null; | ||
| 573 | const new_argv = new_argv_with_sentinel[0..argv.items.len :null]; | ||
| 574 | for (argv.items) |arg, i| { | 571 | for (argv.items) |arg, i| { |
| 575 | new_argv[i] = try arena.dupeZ(u8, arg); | 572 | new_argv[i] = try arena.dupeZ(u8, arg); |
| 576 | } | 573 | } |
src/link/Wasm.zig+1-4| ... | @@ -385,10 +385,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { | ... | @@ -385,10 +385,7 @@ fn linkWithLLD(self: *Wasm, comp: *Compilation) !void { |
| 385 | Compilation.dump_argv(argv.items); | 385 | Compilation.dump_argv(argv.items); |
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | // TODO allocSentinel crashed stage1 so this is working around it. | 388 | const new_argv = try arena.allocSentinel(?[*:0]const u8, argv.items.len, null); |
| 389 | const new_argv_with_sentinel = try arena.alloc(?[*:0]const u8, argv.items.len + 1); | ||
| 390 | new_argv_with_sentinel[argv.items.len] = null; | ||
| 391 | const new_argv = new_argv_with_sentinel[0..argv.items.len :null]; | ||
| 392 | for (argv.items) |arg, i| { | 389 | for (argv.items) |arg, i| { |
| 393 | new_argv[i] = try arena.dupeZ(u8, arg); | 390 | new_argv[i] = try arena.dupeZ(u8, arg); |
| 394 | } | 391 | } |