aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Kupty <hkupty@gmail.com>2025-09-25 23:29:34 +0200
committerRyan Liptak <squeek502@hotmail.com>2025-10-03 16:29:08 -0700
commita0ec5d1c6ee38e8084e8293030804e4c84fa3b56 (patch)
tree67bcebf10baaa64fdc1a0929717f2300ce36e3c1
parent7bee39c1fdf19303f8c174727ce84ae787ad35bf (diff)
downloadzig-a0ec5d1c6ee38e8084e8293030804e4c84fa3b56.tar.gz
zig-a0ec5d1c6ee38e8084e8293030804e4c84fa3b56.zip
fix: Match prefix with static string map
Co-authored-by: Ryan Liptak <squeek502@hotmail.com>
-rw-r--r--tools/update_mingw.zig24
1 files changed, 11 insertions, 13 deletions
diff --git a/tools/update_mingw.zig b/tools/update_mingw.zig
index 3f82093681..138179d2fa 100644
--- a/tools/update_mingw.zig
+++ b/tools/update_mingw.zig
@@ -118,11 +118,9 @@ pub fn main() !void {
switch (entry.kind) {
.directory => {
switch (walker.depth()) {
- 1 => for (def_dirs) |p| {
- if (std.mem.eql(u8, entry.basename, p)) {
- try walker.enter(entry);
- continue;
- }
+ 1 => if (def_dirs.get(entry.basename)) {
+ try walker.enter(entry);
+ continue;
},
else => {
// The top-level directory was already validated
@@ -174,14 +172,14 @@ const def_exts = [_][]const u8{
".def.in",
};
-const def_dirs = [_][]const u8{
- "lib32" ++ std.fs.path.sep_str,
- "lib64" ++ std.fs.path.sep_str,
- "libarm32" ++ std.fs.path.sep_str,
- "libarm64" ++ std.fs.path.sep_str,
- "lib-common" ++ std.fs.path.sep_str,
- "def-include" ++ std.fs.path.sep_str,
-};
+const def_dirs = std.StaticStringMap(void).initComptime(.{
+ .{"lib32"},
+ .{"lib64"},
+ .{"libarm32"},
+ .{"libarm64"},
+ .{"lib-common"},
+ .{"def-include"},
+});
const blacklisted_defs = [_][]const u8{
"crtdll.def.in",