fix: Match prefix with static string map

Co-authored-by: Ryan Liptak <squeek502@hotmail.com>
This commit is contained in:
Henry Kupty 2025-09-25 23:29:34 +02:00 committed by Ryan Liptak
parent 7bee39c1fd
commit a0ec5d1c6e

View File

@ -118,11 +118,9 @@ pub fn main() !void {
switch (entry.kind) { switch (entry.kind) {
.directory => { .directory => {
switch (walker.depth()) { switch (walker.depth()) {
1 => for (def_dirs) |p| { 1 => if (def_dirs.get(entry.basename)) {
if (std.mem.eql(u8, entry.basename, p)) { try walker.enter(entry);
try walker.enter(entry); continue;
continue;
}
}, },
else => { else => {
// The top-level directory was already validated // The top-level directory was already validated
@ -174,14 +172,14 @@ const def_exts = [_][]const u8{
".def.in", ".def.in",
}; };
const def_dirs = [_][]const u8{ const def_dirs = std.StaticStringMap(void).initComptime(.{
"lib32" ++ std.fs.path.sep_str, .{"lib32"},
"lib64" ++ std.fs.path.sep_str, .{"lib64"},
"libarm32" ++ std.fs.path.sep_str, .{"libarm32"},
"libarm64" ++ std.fs.path.sep_str, .{"libarm64"},
"lib-common" ++ std.fs.path.sep_str, .{"lib-common"},
"def-include" ++ std.fs.path.sep_str, .{"def-include"},
}; });
const blacklisted_defs = [_][]const u8{ const blacklisted_defs = [_][]const u8{
"crtdll.def.in", "crtdll.def.in",