authorgravatar for kenta@lithdew.netKenta Iwasaki <kenta@lithdew.net> 2021-05-31 15:57:48+09:00
committergravatar for kenta@lithdew.netKenta Iwasaki <kenta@lithdew.net> 2021-06-01 18:24:43+09:00
log6950e4c2943d7eee1868aff1bf9e24f6bb310f60
treeb218b079cdf336eae55cb9622bff5192f76e7605
parent278e5d398ea137a4c81bd00b1f40e50a16755684

x/os/net: remove unnecessary comptime prefix in resolveScopeID()


3 files changed, 4 insertions(+), 4 deletions(-)

lib/std/mem.zig+1-1
...@@ -2201,7 +2201,7 @@ pub fn collapseRepeatsLen(comptime T: type, slice: []T, elem: T) usize {...@@ -2201,7 +2201,7 @@ pub fn collapseRepeatsLen(comptime T: type, slice: []T, elem: T) usize {
22012201
2202/// Collapse consecutive duplicate elements into one entry.2202/// Collapse consecutive duplicate elements into one entry.
2203pub fn collapseRepeats(comptime T: type, slice: []T, elem: T) []T {2203pub fn collapseRepeats(comptime T: type, slice: []T, elem: T) []T {
2204 return slice[0 .. collapseRepeatsLen(T, slice, elem)];2204 return slice[0..collapseRepeatsLen(T, slice, elem)];
2205}2205}
22062206
2207fn testCollapseRepeats(str: []const u8, elem: u8, expected: []const u8) !void {2207fn testCollapseRepeats(str: []const u8, elem: u8, expected: []const u8) !void {
lib/std/os/windows.zig+1-1
...@@ -1844,7 +1844,7 @@ pub fn sliceToPrefixedFileW(s: []const u8) !PathSpace {...@@ -1844,7 +1844,7 @@ pub fn sliceToPrefixedFileW(s: []const u8) !PathSpace {
1844}1844}
18451845
1846fn getFullPathNameW(path: [*:0]const u16, out: []u16) !usize {1846fn getFullPathNameW(path: [*:0]const u16, out: []u16) !usize {
1847 const result= kernel32.GetFullPathNameW(path, @intCast(u32, out.len), std.meta.assumeSentinel(out.ptr, 0), null);1847 const result = kernel32.GetFullPathNameW(path, @intCast(u32, out.len), std.meta.assumeSentinel(out.ptr, 0), null);
1848 if (result == 0) {1848 if (result == 0) {
1849 switch (kernel32.GetLastError()) {1849 switch (kernel32.GetLastError()) {
1850 else => |err| return unexpectedError(err),1850 else => |err| return unexpectedError(err),
lib/std/x/os/net.zig+2-2
...@@ -17,10 +17,10 @@ const native_os = std.Target.current.os;...@@ -17,10 +17,10 @@ const native_os = std.Target.current.os;
17/// an error if either resolution fails, or if the interface name is17/// an error if either resolution fails, or if the interface name is
18/// too long.18/// too long.
19pub fn resolveScopeID(name: []const u8) !u32 {19pub fn resolveScopeID(name: []const u8) !u32 {
20 if (comptime @hasDecl(os, "IFNAMESIZE")) {20 if (@hasDecl(os, "IFNAMESIZE")) {
21 if (name.len >= os.IFNAMESIZE - 1) return error.NameTooLong;21 if (name.len >= os.IFNAMESIZE - 1) return error.NameTooLong;
2222
23 if (comptime native_os.tag == .windows) {23 if (native_os.tag == .windows) {
24 var interface_name: [os.IFNAMESIZE]u8 = undefined;24 var interface_name: [os.IFNAMESIZE]u8 = undefined;
25 mem.copy(u8, &interface_name, name);25 mem.copy(u8, &interface_name, name);
26 interface_name[name.len] = 0;26 interface_name[name.len] = 0;