mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
x/os/net: remove unnecessary comptime prefix in resolveScopeID()
This commit is contained in:
parent
278e5d398e
commit
6950e4c294
@ -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 {
|
||||
|
||||
@ -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),
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user