mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Build.zig_exe: make it sentinel-aware
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 #14462
This commit is contained in:
parent
2089b3f193
commit
9f2aa3fbee
@ -1008,13 +1008,13 @@ fn usageAndErr(builder: *std.Build, already_ran_build: bool, out_stream: anytype
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
fn nextArg(args: [][]const u8, idx: *usize) ?[]const u8 {
|
||||
fn nextArg(args: [][:0]const u8, idx: *usize) ?[:0]const u8 {
|
||||
if (idx.* >= args.len) return null;
|
||||
defer idx.* += 1;
|
||||
return args[idx.*];
|
||||
}
|
||||
|
||||
fn argsRest(args: [][]const u8, idx: usize) ?[][]const u8 {
|
||||
fn argsRest(args: [][:0]const u8, idx: usize) ?[][:0]const u8 {
|
||||
if (idx >= args.len) return null;
|
||||
return args[idx..];
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ verbose_cimport: bool,
|
||||
verbose_llvm_cpu_features: bool,
|
||||
reference_trace: ?u32 = null,
|
||||
invalid_user_input: bool,
|
||||
zig_exe: []const u8,
|
||||
zig_exe: [:0]const u8,
|
||||
default_step: *Step,
|
||||
env_map: *EnvMap,
|
||||
top_level_steps: std.StringArrayHashMapUnmanaged(*TopLevelStep),
|
||||
@ -184,7 +184,7 @@ pub const DirList = struct {
|
||||
|
||||
pub fn create(
|
||||
allocator: Allocator,
|
||||
zig_exe: []const u8,
|
||||
zig_exe: [:0]const u8,
|
||||
build_root: Cache.Directory,
|
||||
cache_root: Cache.Directory,
|
||||
global_cache_root: Cache.Directory,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user