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...@@ -114,19 +114,19 @@ pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool
114 return false;114 return false;
115}115}
116116
117pub fn file_list(dpath: string) ![]const string {117pub fn file_list(alloc: *std.mem.Allocator, dpath: string) ![]const string {
118 var list = std.ArrayList(string).init(gpa);118 var list = std.ArrayList(string).init(alloc);
119 defer list.deinit();119 defer list.deinit();
120120
121 const dir = try std.fs.cwd().openDir(dpath, .{ .iterate = true });121 const dir = try std.fs.cwd().openDir(dpath, .{ .iterate = true });
122 var walk = try dir.walk(gpa);122 var walk = try dir.walk(alloc);
123 defer walk.deinit();123 defer walk.deinit();
124 while (true) {124 while (true) {
125 if (try walk.next()) |entry| {125 if (try walk.next()) |entry| {
126 if (entry.kind != .File) {126 if (entry.kind != .File) {
127 continue;127 continue;
128 }128 }
129 try list.append(try gpa.dupe(u8, entry.path));129 try list.append(try alloc.dupe(u8, entry.path));
130 } else {130 } else {
131 break;131 break;
132 }132 }
src/util/module.zig+1-1
...@@ -58,7 +58,7 @@ pub const Module = struct {...@@ -58,7 +58,7 @@ pub const Module = struct {
58 }58 }
5959
60 pub fn get_hash(self: Module, cdpath: string) !string {60 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
63 var file_list_2 = std.ArrayList(string).init(self.alloc);63 var file_list_2 = std.ArrayList(string).init(self.alloc);
64 defer file_list_2.deinit();64 defer file_list_2.deinit();