| author | |
| committer | |
| log | f9585ad01fb1c5709fe448128b1a75cdf3597575 |
| tree | 99d1ada771cbf8d0880d644955a6454a8058b4e7 |
| parent | 9009ab2495a6f6c7eaa990d87986f32c85360667 |
11 files changed, 33 insertions(+), 106 deletions(-)
test/standalone/dirname/exists_in.zig+2-10| ... | ... | @@ -11,16 +11,8 @@ |
| 11 | 11 | |
| 12 | 12 | const std = @import("std"); |
| 13 | 13 | |
| 14 | pub fn main() !void { | |
| 15 | var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
| 16 | const arena = arena_state.allocator(); | |
| 17 | defer arena_state.deinit(); | |
| 18 | ||
| 19 | try run(arena); | |
| 20 | } | |
| 21 | ||
| 22 | fn run(allocator: std.mem.Allocator) !void { | |
| 23 | var args = try std.process.argsWithAllocator(allocator); | |
| 14 | pub fn main(init: std.process.Init) !void { | |
| 15 | var args = try init.args.iterateAllocator(init.arena); | |
| 24 | 16 | defer args.deinit(); |
| 25 | 17 | _ = args.next() orelse unreachable; // skip binary name |
| 26 | 18 |
test/standalone/dirname/has_basename.zig+2-10| ... | ... | @@ -13,16 +13,8 @@ |
| 13 | 13 | |
| 14 | 14 | const std = @import("std"); |
| 15 | 15 | |
| 16 | pub fn main() !void { | |
| 17 | var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
| 18 | const arena = arena_state.allocator(); | |
| 19 | defer arena_state.deinit(); | |
| 20 | ||
| 21 | try run(arena); | |
| 22 | } | |
| 23 | ||
| 24 | fn run(allocator: std.mem.Allocator) !void { | |
| 25 | var args = try std.process.argsWithAllocator(allocator); | |
| 16 | pub fn main(init: std.process.Init) !void { | |
| 17 | var args = try init.args.iterateAllocator(init.arena); | |
| 26 | 18 | defer args.deinit(); |
| 27 | 19 | _ = args.next() orelse unreachable; // skip binary name |
| 28 | 20 |
test/standalone/dirname/touch.zig+2-10| ... | ... | @@ -8,16 +8,8 @@ |
| 8 | 8 | |
| 9 | 9 | const std = @import("std"); |
| 10 | 10 | |
| 11 | pub fn main() !void { | |
| 12 | var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
| 13 | const arena = arena_state.allocator(); | |
| 14 | defer arena_state.deinit(); | |
| 15 | ||
| 16 | try run(arena); | |
| 17 | } | |
| 18 | ||
| 19 | fn run(allocator: std.mem.Allocator) !void { | |
| 20 | var args = try std.process.argsWithAllocator(allocator); | |
| 11 | pub fn main(init: std.process.Init) !void { | |
| 12 | var args = try init.args.iterateAllocator(init.arena); | |
| 21 | 13 | defer args.deinit(); |
| 22 | 14 | _ = args.next() orelse unreachable; // skip binary name |
| 23 | 15 |
tools/dump-cov.zig+5-14| ... | ... | @@ -8,20 +8,11 @@ const Path = std.Build.Cache.Path; |
| 8 | 8 | const assert = std.debug.assert; |
| 9 | 9 | const SeenPcsHeader = std.Build.abi.fuzz.SeenPcsHeader; |
| 10 | 10 | |
| 11 | pub fn main() !void { | |
| 12 | var debug_allocator: std.heap.DebugAllocator(.{}) = .init; | |
| 13 | defer _ = debug_allocator.deinit(); | |
| 14 | const gpa = debug_allocator.allocator(); | |
| 15 | ||
| 16 | var arena_instance: std.heap.ArenaAllocator = .init(gpa); | |
| 17 | defer arena_instance.deinit(); | |
| 18 | const arena = arena_instance.allocator(); | |
| 19 | ||
| 20 | var threaded: Io.Threaded = .init(gpa, .{}); | |
| 21 | defer threaded.deinit(); | |
| 22 | const io = threaded.io(); | |
| 23 | ||
| 24 | const args = try std.process.argsAlloc(arena); | |
| 11 | pub fn main(init: std.process.Init) !void { | |
| 12 | const gpa = init.gpa; | |
| 13 | const arena = init.arena; | |
| 14 | const io = init.io; | |
| 15 | const args = try init.args.toSlice(arena); | |
| 25 | 16 | |
| 26 | 17 | const target_query_str = switch (args.len) { |
| 27 | 18 | 3 => "native", |
tools/fetch_them_macos_headers.zig+3-6| ... | ... | @@ -66,12 +66,9 @@ const usage = |
| 66 | 66 | \\-h, --help Print this help and exit |
| 67 | 67 | ; |
| 68 | 68 | |
| 69 | pub fn main() anyerror!void { | |
| 70 | var arena = std.heap.ArenaAllocator.init(gpa); | |
| 71 | defer arena.deinit(); | |
| 72 | const allocator = arena.allocator(); | |
| 73 | ||
| 74 | const args = try std.process.argsAlloc(allocator); | |
| 69 | pub fn main(init: std.process.Init) !void { | |
| 70 | const allocator = init.arena; | |
| 71 | const args = try init.args.toSlice(allocator); | |
| 75 | 72 | |
| 76 | 73 | var argv = std.array_list.Managed([]const u8).init(allocator); |
| 77 | 74 | var sysroot: ?[]const u8 = null; |
tools/gen_macos_headers_c.zig+4-12| ... | ... | @@ -6,9 +6,6 @@ const info = std.log.info; |
| 6 | 6 | const fatal = std.process.fatal; |
| 7 | 7 | const Allocator = std.mem.Allocator; |
| 8 | 8 | |
| 9 | var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; | |
| 10 | const gpa = general_purpose_allocator.allocator(); | |
| 11 | ||
| 12 | 9 | const usage = |
| 13 | 10 | \\gen_macos_headers_c [dir] |
| 14 | 11 | \\ |
| ... | ... | @@ -16,16 +13,11 @@ const usage = |
| 16 | 13 | \\-h, --help Print this help and exit |
| 17 | 14 | ; |
| 18 | 15 | |
| 19 | pub fn main() anyerror!void { | |
| 20 | var arena_allocator = std.heap.ArenaAllocator.init(gpa); | |
| 21 | defer arena_allocator.deinit(); | |
| 22 | const arena = arena_allocator.allocator(); | |
| 23 | ||
| 24 | var threaded: Io.Threaded = .init(gpa, .{}); | |
| 25 | defer threaded.deinit(); | |
| 26 | const io = threaded.io(); | |
| 16 | pub fn main(init: std.process.Init) !void { | |
| 17 | const arena = init.arena; | |
| 18 | const io = init.io; | |
| 27 | 19 | |
| 28 | const args = try std.process.argsAlloc(arena); | |
| 20 | const args = try init.args.toSlice(arena); | |
| 29 | 21 | if (args.len == 1) fatal("no command or option specified", .{}); |
| 30 | 22 | |
| 31 | 23 | var positionals = std.array_list.Managed([]const u8).init(arena); |
tools/gen_outline_atomics.zig+3-8| ... | ... | @@ -11,14 +11,9 @@ const AtomicOp = enum { |
| 11 | 11 | ldset, |
| 12 | 12 | }; |
| 13 | 13 | |
| 14 | pub fn main() !void { | |
| 15 | var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
| 16 | defer arena_instance.deinit(); | |
| 17 | const arena = arena_instance.allocator(); | |
| 18 | ||
| 19 | var threaded: std.Io.Threaded = .init(arena, .{}); | |
| 20 | defer threaded.deinit(); | |
| 21 | const io = threaded.io(); | |
| 14 | pub fn main(init: std.process.Init) !void { | |
| 15 | const arena = init.arena; | |
| 16 | const io = init.io; | |
| 22 | 17 | |
| 23 | 18 | //const args = try std.process.argsAlloc(arena); |
| 24 | 19 |
tools/generate_JSONTestSuite.zig+3-7| ... | ... | @@ -3,13 +3,9 @@ |
| 3 | 3 | const std = @import("std"); |
| 4 | 4 | const Io = std.Io; |
| 5 | 5 | |
| 6 | pub fn main() !void { | |
| 7 | var gpa: std.heap.GeneralPurposeAllocator(.{}) = .init; | |
| 8 | var allocator = gpa.allocator(); | |
| 9 | ||
| 10 | var threaded: std.Io.Threaded = .init(allocator, .{}); | |
| 11 | defer threaded.deinit(); | |
| 12 | const io = threaded.io(); | |
| 6 | pub fn main(init: std.process.Init) !void { | |
| 7 | const allocator = init.gpa; | |
| 8 | const io = init.io; | |
| 13 | 9 | |
| 14 | 10 | var stdout_buffer: [2000]u8 = undefined; |
| 15 | 11 | var stdout_writer = Io.File.stdout().writerStreaming(io, &stdout_buffer); |
tools/generate_c_size_and_align_checks.zig+3-10| ... | ... | @@ -28,22 +28,15 @@ fn cName(ty: std.Target.CType) []const u8 { |
| 28 | 28 | |
| 29 | 29 | var general_purpose_allocator: std.heap.GeneralPurposeAllocator(.{}) = .init; |
| 30 | 30 | |
| 31 | pub fn main() !void { | |
| 32 | const gpa = general_purpose_allocator.allocator(); | |
| 33 | defer std.debug.assert(general_purpose_allocator.deinit() == .ok); | |
| 34 | ||
| 35 | const args = try std.process.argsAlloc(gpa); | |
| 36 | defer std.process.argsFree(gpa, args); | |
| 31 | pub fn main(init: std.process.Init) !void { | |
| 32 | const args = try init.args.toSlice(init.arena); | |
| 33 | const io = init.io; | |
| 37 | 34 | |
| 38 | 35 | if (args.len != 2) { |
| 39 | 36 | std.debug.print("Usage: {s} [target_triple]\n", .{args[0]}); |
| 40 | 37 | std.process.exit(1); |
| 41 | 38 | } |
| 42 | 39 | |
| 43 | var threaded: std.Io.Threaded = .init(gpa, .{}); | |
| 44 | defer threaded.deinit(); | |
| 45 | const io = threaded.io(); | |
| 46 | ||
| 47 | 40 | const query = try std.Target.Query.parse(.{ .arch_os_abi = args[1] }); |
| 48 | 41 | const target = try std.zig.system.resolveTargetQuery(io, query); |
| 49 | 42 |
tools/generate_linux_syscalls.zig+3-8| ... | ... | @@ -170,14 +170,9 @@ const architectures: []const Arch = &.{ |
| 170 | 170 | // .{ .@"var" = "Microblaze", .table = .{ .specific = "arch/microblaze/kernel/syscalls/syscall.tbl" } }, |
| 171 | 171 | }; |
| 172 | 172 | |
| 173 | pub fn main() !void { | |
| 174 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
| 175 | defer arena.deinit(); | |
| 176 | const gpa = arena.allocator(); | |
| 177 | ||
| 178 | var threaded: Io.Threaded = .init(gpa, .{}); | |
| 179 | defer threaded.deinit(); | |
| 180 | const io = threaded.io(); | |
| 173 | pub fn main(init: std.process.Init) !void { | |
| 174 | const gpa = init.gpa; | |
| 175 | const io = init.io; | |
| 181 | 176 | |
| 182 | 177 | const args = try std.process.argsAlloc(gpa); |
| 183 | 178 | if (args.len < 2 or mem.eql(u8, args[1], "--help")) { |
tools/incr-check.zig+3-11| ... | ... | @@ -27,18 +27,10 @@ fn logImpl( |
| 27 | 27 | ); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | pub fn main() !void { | |
| 30 | pub fn main(init: std.process.Init) !void { | |
| 31 | 31 | const fatal = std.process.fatal; |
| 32 | ||
| 33 | var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
| 34 | defer arena_instance.deinit(); | |
| 35 | const arena = arena_instance.allocator(); | |
| 36 | ||
| 37 | const gpa = arena; | |
| 38 | ||
| 39 | var threaded: Io.Threaded = .init(gpa, .{}); | |
| 40 | defer threaded.deinit(); | |
| 41 | const io = threaded.io(); | |
| 32 | const arena = init.arena; | |
| 33 | const io = init.io; | |
| 42 | 34 | |
| 43 | 35 | var opt_zig_exe: ?[]const u8 = null; |
| 44 | 36 | var opt_input_file_name: ?[]const u8 = null; |