std: Replace lastIndexOf with lastIndexOfScalar

This may work around the miscompilation in LLVM 12.
This commit is contained in:
LemonBoy
2021-03-01 20:06:30 +01:00
committed by Andrew Kelley
parent baab1b2f31
commit bee7db77fe

View File

@@ -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..];
}