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

This commit is contained in:
Kenta Iwasaki 2021-05-31 15:57:48 +09:00
parent 278e5d398e
commit 6950e4c294
3 changed files with 4 additions and 4 deletions

View File

@ -2201,7 +2201,7 @@ pub fn collapseRepeatsLen(comptime T: type, slice: []T, elem: T) usize {
/// Collapse consecutive duplicate elements into one entry.
pub fn collapseRepeats(comptime T: type, slice: []T, elem: T) []T {
return slice[0 .. collapseRepeatsLen(T, slice, elem)];
return slice[0..collapseRepeatsLen(T, slice, elem)];
}
fn testCollapseRepeats(str: []const u8, elem: u8, expected: []const u8) !void {

View File

@ -1844,7 +1844,7 @@ pub fn sliceToPrefixedFileW(s: []const u8) !PathSpace {
}
fn getFullPathNameW(path: [*:0]const u16, out: []u16) !usize {
const result= kernel32.GetFullPathNameW(path, @intCast(u32, out.len), std.meta.assumeSentinel(out.ptr, 0), null);
const result = kernel32.GetFullPathNameW(path, @intCast(u32, out.len), std.meta.assumeSentinel(out.ptr, 0), null);
if (result == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),

View File

@ -17,10 +17,10 @@ const native_os = std.Target.current.os;
/// an error if either resolution fails, or if the interface name is
/// too long.
pub fn resolveScopeID(name: []const u8) !u32 {
if (comptime @hasDecl(os, "IFNAMESIZE")) {
if (@hasDecl(os, "IFNAMESIZE")) {
if (name.len >= os.IFNAMESIZE - 1) return error.NameTooLong;
if (comptime native_os.tag == .windows) {
if (native_os.tag == .windows) {
var interface_name: [os.IFNAMESIZE]u8 = undefined;
mem.copy(u8, &interface_name, name);
interface_name[name.len] = 0;