Remove unnecessary indirection

This commit is contained in:
J.C. Moyer 2022-09-28 10:10:27 -04:00
parent cbc6feeb76
commit 295669297a

View File

@ -178,7 +178,7 @@ fn loadBuildConfiguration(context: LoadBuildConfigContext) !void {
defer if (context.build_file_path == null) allocator.free(build_file_path); defer if (context.build_file_path == null) allocator.free(build_file_path);
const directory_path = build_file_path[0 .. build_file_path.len - "build.zig".len]; const directory_path = build_file_path[0 .. build_file_path.len - "build.zig".len];
const standard_args = &[_][]const u8{ const standard_args = [_][]const u8{
zig_exe_path, zig_exe_path,
"run", "run",
build_runner_path, build_runner_path,
@ -198,7 +198,7 @@ fn loadBuildConfiguration(context: LoadBuildConfigContext) !void {
var args = try arena_allocator.alloc([]const u8, standard_args.len + if (build_file.build_options) |opts| opts.len else 0); var args = try arena_allocator.alloc([]const u8, standard_args.len + if (build_file.build_options) |opts| opts.len else 0);
defer arena_allocator.free(args); defer arena_allocator.free(args);
args[0..standard_args.len].* = standard_args.*; args[0..standard_args.len].* = standard_args;
if (build_file.build_options) |opts| { if (build_file.build_options) |opts| {
for (opts) |opt, i| { for (opts) |opt, i| {
args[standard_args.len + i] = try opt.formatParam(arena_allocator); args[standard_args.len + i] = try opt.formatParam(arena_allocator);