authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-04-09 01:20:27 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-04-09 01:20:27 -07:00
logcceff1ebece47368b827ec426c5dca230142ff3d
tree77eb832107935fc96f84808c2a2116a424491aa2
parent85d569f3566f932cdd6b6e9a04e6b117341f956c
signaturelock-open Commit is signed but in an unrecognized format.

cmd/sum- common has a dedupe func already


1 files changed, 1 insertions(+), 13 deletions(-)

src/cmd/sum.zig+1-13
...@@ -24,7 +24,7 @@ pub fn execute(args: [][]u8) !void {...@@ -24,7 +24,7 @@ pub fn execute(args: [][]u8) !void {
2424
25 //25 //
26 const module_list = &std.ArrayList(u.Module).init(gpa);26 const module_list = &std.ArrayList(u.Module).init(gpa);
27 try dedupe_mod_list(module_list, top_module);27 try common.collect_pkgs(top_module, module_list);
2828
29 for (module_list.items) |m| {29 for (module_list.items) |m| {
30 if (m.clean_path.len == 0) { continue; }30 if (m.clean_path.len == 0) { continue; }
...@@ -32,15 +32,3 @@ pub fn execute(args: [][]u8) !void {...@@ -32,15 +32,3 @@ pub fn execute(args: [][]u8) !void {
32 try w.print("{s} {s}\n", .{hash, m.clean_path});32 try w.print("{s} {s}\n", .{hash, m.clean_path});
33 }33 }
34}34}
35
36fn dedupe_mod_list(list: *std.ArrayList(u.Module), module: u.Module) anyerror!void {
37 if (u.list_contains_gen(u.Module, list, module)) {
38 return;
39 }
40 if (module.clean_path.len > 0) {
41 try list.append(module);
42 }
43 for (module.deps) |m| {
44 try dedupe_mod_list(list, m);
45 }
46}