authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-28 03:41:03 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-10-28 03:41:03 -07:00
logf9ed63ba65289f3e0ef5b0d8609d09996780c767
tree3ba5ea368bccd21c9eb75fcae70fbfdf63a37584
parent95a6cb16851902edcdabb1c58b0c6a9c88f8a5bf

remove global allocator from u.file_list


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

src/util/funcs.zig+4-4
......@@ -114,19 +114,19 @@ pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool
114114 return false;
115115}
116116
117pub fn file_list(dpath: string) ![]const string {
118 var list = std.ArrayList(string).init(gpa);
117pub fn file_list(alloc: *std.mem.Allocator, dpath: string) ![]const string {
118 var list = std.ArrayList(string).init(alloc);
119119 defer list.deinit();
120120
121121 const dir = try std.fs.cwd().openDir(dpath, .{ .iterate = true });
122 var walk = try dir.walk(gpa);
122 var walk = try dir.walk(alloc);
123123 defer walk.deinit();
124124 while (true) {
125125 if (try walk.next()) |entry| {
126126 if (entry.kind != .File) {
127127 continue;
128128 }
129 try list.append(try gpa.dupe(u8, entry.path));
129 try list.append(try alloc.dupe(u8, entry.path));
130130 } else {
131131 break;
132132 }
src/util/module.zig+1-1
......@@ -58,7 +58,7 @@ pub const Module = struct {
5858 }
5959
6060 pub fn get_hash(self: Module, cdpath: string) !string {
61 const file_list_1 = try u.file_list(try std.mem.concat(self.alloc, u8, &.{ cdpath, "/", self.clean_path }));
61 const file_list_1 = try u.file_list(self.alloc, try std.mem.concat(self.alloc, u8, &.{ cdpath, "/", self.clean_path }));
6262
6363 var file_list_2 = std.ArrayList(string).init(self.alloc);
6464 defer file_list_2.deinit();