authorgravatar for hkupty@gmail.comHenry Kupty <hkupty@gmail.com> 2025-09-25 23:29:34+02:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2025-10-03 16:29:08-07:00
loga0ec5d1c6ee38e8084e8293030804e4c84fa3b56
tree67bcebf10baaa64fdc1a0929717f2300ce36e3c1
parent7bee39c1fdf19303f8c174727ce84ae787ad35bf

fix: Match prefix with static string map

Co-authored-by: Ryan Liptak <squeek502@hotmail.com>

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

tools/update_mingw.zig+11-13
...@@ -118,11 +118,9 @@ pub fn main() !void {...@@ -118,11 +118,9 @@ pub fn main() !void {
118 switch (entry.kind) {118 switch (entry.kind) {
119 .directory => {119 .directory => {
120 switch (walker.depth()) {120 switch (walker.depth()) {
121 1 => for (def_dirs) |p| {121 1 => if (def_dirs.get(entry.basename)) {
122 if (std.mem.eql(u8, entry.basename, p)) {122 try walker.enter(entry);
123 try walker.enter(entry);123 continue;
124 continue;
125 }
126 },124 },
127 else => {125 else => {
128 // The top-level directory was already validated126 // The top-level directory was already validated
...@@ -174,14 +172,14 @@ const def_exts = [_][]const u8{...@@ -174,14 +172,14 @@ const def_exts = [_][]const u8{
174 ".def.in",172 ".def.in",
175};173};
176174
177const def_dirs = [_][]const u8{175const def_dirs = std.StaticStringMap(void).initComptime(.{
178 "lib32" ++ std.fs.path.sep_str,176 .{"lib32"},
179 "lib64" ++ std.fs.path.sep_str,177 .{"lib64"},
180 "libarm32" ++ std.fs.path.sep_str,178 .{"libarm32"},
181 "libarm64" ++ std.fs.path.sep_str,179 .{"libarm64"},
182 "lib-common" ++ std.fs.path.sep_str,180 .{"lib-common"},
183 "def-include" ++ std.fs.path.sep_str,181 .{"def-include"},
184};182});
185183
186const blacklisted_defs = [_][]const u8{184const blacklisted_defs = [_][]const u8{
187 "crtdll.def.in",185 "crtdll.def.in",