authorgravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2026-10-23 09:03:25+02:00
committergravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2026-10-23 09:03:25+02:00
logb5ed0ae2cecb96adca7b259f7054519c92a3283f
treeef5e9ef53e900fd3b4ffd0e7db8a79b06bb2e2b4
parentfb255db0adc7fb39f4d33738fcf3c5831a1a7649

Remove usages of array_list.Managed in lib/compiler/Maker


3 files changed, 18 insertions(+), 15 deletions(-)

lib/compiler/Maker.zig+11-8
......@@ -4677,12 +4677,13 @@ test sanitizeExampleName {
46774677const Templates = struct {
46784678 zig_lib_directory: Cache.Directory,
46794679 dir: Io.Dir,
4680 buffer: std.array_list.Managed(u8),
4680 buffer: std.ArrayList(u8),
4681 gpa: Allocator,
46814682
46824683 fn deinit(templates: *Templates, io: Io) void {
46834684 templates.zig_lib_directory.handle.close(io);
46844685 templates.dir.close(io);
4685 templates.buffer.deinit();
4686 templates.buffer.deinit(templates.gpa);
46864687 templates.* = undefined;
46874688 }
46884689
......@@ -4705,29 +4706,30 @@ const Templates = struct {
47054706 const contents = templates.dir.readFileAlloc(io, template_path, arena, .limited(max_bytes)) catch |err| {
47064707 fatal("unable to read template file {q}: {t}", .{ template_path, err });
47074708 };
4709 const gpa = templates.gpa;
47084710 templates.buffer.clearRetainingCapacity();
4709 try templates.buffer.ensureUnusedCapacity(contents.len);
4711 try templates.buffer.ensureUnusedCapacity(gpa, contents.len);
47104712 var i: usize = 0;
47114713 while (i < contents.len) {
47124714 if (contents[i] == '_' or contents[i] == '.') {
47134715 // Both '_' and '.' are allowed because depending on the context
47144716 // one prefix will be valid, while the other might not.
47154717 if (std.mem.startsWith(u8, contents[i + 1 ..], "NAME")) {
4716 try templates.buffer.appendSlice(root_name);
4718 try templates.buffer.appendSlice(gpa, root_name);
47174719 i += "_NAME".len;
47184720 continue;
47194721 } else if (std.mem.startsWith(u8, contents[i + 1 ..], "FINGERPRINT")) {
4720 try templates.buffer.print("0x{x}", .{fingerprint.int()});
4722 try templates.buffer.print(gpa, "0x{x}", .{fingerprint.int()});
47214723 i += "_FINGERPRINT".len;
47224724 continue;
47234725 } else if (std.mem.startsWith(u8, contents[i + 1 ..], "ZIGVER")) {
4724 try templates.buffer.appendSlice(builtin.zig_version_string);
4726 try templates.buffer.appendSlice(gpa, builtin.zig_version_string);
47254727 i += "_ZIGVER".len;
47264728 continue;
47274729 }
47284730 }
47294731
4730 try templates.buffer.append(contents[i]);
4732 try templates.buffer.append(gpa, contents[i]);
47314733 i += 1;
47324734 }
47334735
......@@ -4748,7 +4750,8 @@ const Templates = struct {
47484750 return .{
47494751 .zig_lib_directory = zig_lib_directory,
47504752 .dir = template_dir,
4751 .buffer = std.array_list.Managed(u8).init(gpa),
4753 .buffer = .empty,
4754 .gpa = gpa,
47524755 };
47534756 }
47544757
lib/compiler/Maker/Fetch.zig+6-6
......@@ -1756,11 +1756,11 @@ fn computeHash(f: *Fetch, pkg_path: Path, filter: Filter) RunError!ComputedHash
17561756 const root_dir = pkg_path.root_dir.handle;
17571757
17581758 // Collect all files, recursively, then sort.
1759 var all_files = std.array_list.Managed(*HashedFile).init(gpa);
1760 defer all_files.deinit();
1759 var all_files: std.ArrayList(*HashedFile) = .empty;
1760 defer all_files.deinit(gpa);
17611761
1762 var deleted_files = std.array_list.Managed(*DeletedFile).init(gpa);
1763 defer deleted_files.deinit();
1762 var deleted_files: std.ArrayList(*DeletedFile) = .empty;
1763 defer deleted_files.deinit(gpa);
17641764
17651765 // Track directories which had any files deleted from them so that empty directories
17661766 // can be deleted.
......@@ -1803,7 +1803,7 @@ fn computeHash(f: *Fetch, pkg_path: Path, filter: Filter) RunError!ComputedHash
18031803 .failure = undefined, // to be populated by the worker
18041804 };
18051805 group.async(io, workerDeleteFile, .{ io, root_dir, deleted_file });
1806 try deleted_files.append(deleted_file);
1806 try deleted_files.append(gpa, deleted_file);
18071807 continue;
18081808 }
18091809
......@@ -1831,7 +1831,7 @@ fn computeHash(f: *Fetch, pkg_path: Path, filter: Filter) RunError!ComputedHash
18311831 .size = undefined, // to be populated by the worker
18321832 };
18331833 group.async(io, workerHashFile, .{ io, root_dir, hashed_file });
1834 try all_files.append(hashed_file);
1834 try all_files.append(gpa, hashed_file);
18351835 }
18361836
18371837 try group.await(io);
lib/compiler/Maker/Step/Compile.zig+1-1
......@@ -867,7 +867,7 @@ fn lowerZigArgs(
867867 return step.fail(maker, "failed creating directory {f}: {t}", .{ args_path, err });
868868
869869 const args_to_escape = zig_args.items[2..];
870 var escaped_args = try std.array_list.Managed([]const u8).initCapacity(arena, args_to_escape.len);
870 var escaped_args: std.ArrayList([]const u8) = try .initCapacity(arena, args_to_escape.len);
871871 arg_blk: for (args_to_escape) |arg| {
872872 for (arg, 0..) |c, arg_idx| {
873873 if (c == '\\' or c == '"') {