authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-05 16:13:18 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-06-05 16:13:18 -07:00
log9f5b6060c3cee53f952d2b53b0994832d0c4461b
tree41e52f3f40e64e6e204a3c1fc582d7d98c251fcd
parent70147b37a52266e970d2e762cf7c54617085af33

cmd/fetch- dont modify arraylist contents with a for loop


1 files changed, 2 insertions(+), 7 deletions(-)

src/cmd/fetch.zig+2-7
......@@ -56,11 +56,6 @@ pub fn execute(args: [][]u8) !void {
5656
5757 const list = &std.ArrayList(u.Module).init(gpa);
5858 try common.collect_pkgs(top_module, list);
59 for (list.items) |*mod| {
60 if (mod.id.len > 12) {
61 mod.id = mod.id[0..12];
62 }
63 }
6459
6560 try w.writeAll("pub const _ids = .{\n");
6661 try print_ids(w, list.items);
......@@ -117,7 +112,7 @@ fn print_ids(w: std.fs.File.Writer, list: []u.Module) !void {
117112 if (mod.is_sys_lib) {
118113 continue;
119114 }
120 try w.print(" \"{s}\",\n", .{mod.id});
115 try w.print(" \"{s}\",\n", .{mod.id[0..12]});
121116 }
122117}
123118
......@@ -203,7 +198,7 @@ fn print_csrc_flags_to(w: std.fs.File.Writer, list: []u.Module) !void {
203198 if (mod.c_source_flags.len == 0 and mod.c_source_files.len == 0) {
204199 continue;
205200 }
206 try w.print(" pub const @\"{s}\" = {s}", .{ mod.id, "&.{" });
201 try w.print(" pub const @\"{s}\" = {s}", .{ mod.id[0..12], "&.{" });
207202 for (mod.c_source_flags) |it| {
208203 try w.print("\"{}\",", .{std.zig.fmtEscapes(it)});
209204 }