zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit bee7db77fe65802a41f2812caac4faa7dcb8acd3 (tree)
parent baab1b2f3135a10ed0adb56e653fc300d4add661
Author: LemonBoy <thatlemon@gmail.com>
Date:   Mon,  1 Mar 2021 20:06:30 +0100

std: Replace lastIndexOf with lastIndexOfScalar

This may work around the miscompilation in LLVM 12.

Diffstat:
Mlib/std/fs/path.zig | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/std/fs/path.zig b/lib/std/fs/path.zig @@ -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..]; }