authorgravatar for snoire@qq.comsnoire <snoire@qq.com> 2023-10-20 20:31:32+08:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-10-21 17:48:25+03:00
logb403ca0aabb4529949b48e68f1392afc31098a98
tree1fbea8012d0700a86bdffdb042dd2f72854029dc
parent809e7aa4fc0e613752f8c7a4319ac4157089ea84

std.Build: use create() instead of init() for Step.RemoveDir


2 files changed, 5 insertions(+), 5 deletions(-)

lib/std/Build.zig+1-3
...@@ -971,9 +971,7 @@ pub fn addWriteFiles(b: *Build) *Step.WriteFile {...@@ -971,9 +971,7 @@ pub fn addWriteFiles(b: *Build) *Step.WriteFile {
971}971}
972972
973pub fn addRemoveDirTree(self: *Build, dir_path: []const u8) *Step.RemoveDir {973pub fn addRemoveDirTree(self: *Build, dir_path: []const u8) *Step.RemoveDir {
974 const remove_dir_step = self.allocator.create(Step.RemoveDir) catch @panic("OOM");974 return Step.RemoveDir.create(self, dir_path);
975 remove_dir_step.* = Step.RemoveDir.init(self, dir_path);
976 return remove_dir_step;
977}975}
978976
979pub fn addFmt(b: *Build, options: Step.Fmt.Options) *Step.Fmt {977pub fn addFmt(b: *Build, options: Step.Fmt.Options) *Step.Fmt {
lib/std/Build/Step/RemoveDir.zig+4-2
...@@ -8,8 +8,9 @@ pub const base_id = .remove_dir;...@@ -8,8 +8,9 @@ pub const base_id = .remove_dir;
8step: Step,8step: Step,
9dir_path: []const u8,9dir_path: []const u8,
1010
11pub fn init(owner: *std.Build, dir_path: []const u8) RemoveDir {11pub fn create(owner: *std.Build, dir_path: []const u8) *RemoveDir {
12 return RemoveDir{12 const self = owner.allocator.create(RemoveDir) catch @panic("OOM");
13 self.* = .{
13 .step = Step.init(.{14 .step = Step.init(.{
14 .id = .remove_dir,15 .id = .remove_dir,
15 .name = owner.fmt("RemoveDir {s}", .{dir_path}),16 .name = owner.fmt("RemoveDir {s}", .{dir_path}),
...@@ -18,6 +19,7 @@ pub fn init(owner: *std.Build, dir_path: []const u8) RemoveDir {...@@ -18,6 +19,7 @@ pub fn init(owner: *std.Build, dir_path: []const u8) RemoveDir {
18 }),19 }),
19 .dir_path = owner.dupePath(dir_path),20 .dir_path = owner.dupePath(dir_path),
20 };21 };
22 return self;
21}23}
2224
23fn make(step: *Step, prog_node: *std.Progress.Node) !void {25fn make(step: *Step, prog_node: *std.Progress.Node) !void {