| author | |
| committer | |
| log | 9f2aa3fbeec451021837ca6bca2baa47302f0468 |
| tree | 0e12d0e9526606bb69f66a91bddd56d4cda39bba |
| parent | 2089b3f193beaef6debc5671ca6d1f6fc028db8d |
This is useful for tests that want to `execve` zig directly. The string
is already null-terminated, so this will just expose it as such,
removing an extra allocation from the test.
Will be used in #144622 files changed, 4 insertions(+), 4 deletions(-)
lib/build_runner.zig+2-2| ... | ... | @@ -1008,13 +1008,13 @@ fn usageAndErr(builder: *std.Build, already_ran_build: bool, out_stream: anytype |
| 1008 | 1008 | process.exit(1); |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | fn nextArg(args: [][]const u8, idx: *usize) ?[]const u8 { | |
| 1011 | fn nextArg(args: [][:0]const u8, idx: *usize) ?[:0]const u8 { | |
| 1012 | 1012 | if (idx.* >= args.len) return null; |
| 1013 | 1013 | defer idx.* += 1; |
| 1014 | 1014 | return args[idx.*]; |
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | fn argsRest(args: [][]const u8, idx: usize) ?[][]const u8 { | |
| 1017 | fn argsRest(args: [][:0]const u8, idx: usize) ?[][:0]const u8 { | |
| 1018 | 1018 | if (idx >= args.len) return null; |
| 1019 | 1019 | return args[idx..]; |
| 1020 | 1020 | } |
lib/std/Build.zig+2-2| ... | ... | @@ -60,7 +60,7 @@ verbose_cimport: bool, |
| 60 | 60 | verbose_llvm_cpu_features: bool, |
| 61 | 61 | reference_trace: ?u32 = null, |
| 62 | 62 | invalid_user_input: bool, |
| 63 | zig_exe: []const u8, | |
| 63 | zig_exe: [:0]const u8, | |
| 64 | 64 | default_step: *Step, |
| 65 | 65 | env_map: *EnvMap, |
| 66 | 66 | top_level_steps: std.StringArrayHashMapUnmanaged(*TopLevelStep), |
| ... | ... | @@ -184,7 +184,7 @@ pub const DirList = struct { |
| 184 | 184 | |
| 185 | 185 | pub fn create( |
| 186 | 186 | allocator: Allocator, |
| 187 | zig_exe: []const u8, | |
| 187 | zig_exe: [:0]const u8, | |
| 188 | 188 | build_root: Cache.Directory, |
| 189 | 189 | cache_root: Cache.Directory, |
| 190 | 190 | global_cache_root: Cache.Directory, |