mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
std: Replace lastIndexOf with lastIndexOfScalar
This may work around the miscompilation in LLVM 12.
This commit is contained in:
parent
baab1b2f31
commit
bee7db77fe
@ -1226,7 +1226,7 @@ fn testRelativeWindows(from: []const u8, to: []const u8, expected_output: []cons
|
||||
/// pointer address range of `path`, even if it is length zero.
|
||||
pub fn extension(path: []const u8) []const u8 {
|
||||
const filename = basename(path);
|
||||
const index = mem.lastIndexOf(u8, filename, ".") orelse return path[path.len..];
|
||||
const index = mem.lastIndexOfScalar(u8, filename, '.') orelse return path[path.len..];
|
||||
if (index == 0) return path[path.len..];
|
||||
return filename[index..];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user