authorgravatar for manuel.spagnolo@proton.meManuel Spagnolo <manuel.spagnolo@proton.me> 2025-02-15 18:57:26+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-02-16 01:02:33+01:00
log9ad57515b2af63a573da9a08fa60c3817ddc1a7d
tree68ef7657dc0a227868e877d28c1ad3ee10fb3d8a
parentd7f9b5a6618eebf6f2c7c205ebdad47a7959ecc1

remove unneeded native_os check

The check is not needed, since we are already checking for the os at line 847 and returning at 916 when the check succeeds. Therefore, at 926, we know the os is not windows.

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

lib/std/net.zig+3-4
...@@ -923,7 +923,6 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get...@@ -923,7 +923,6 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get
923 const port_c = try std.fmt.allocPrintZ(allocator, "{}", .{port});923 const port_c = try std.fmt.allocPrintZ(allocator, "{}", .{port});
924 defer allocator.free(port_c);924 defer allocator.free(port_c);
925925
926 const sys = if (native_os == .windows) windows.ws2_32 else posix.system;
927 const hints: posix.addrinfo = .{926 const hints: posix.addrinfo = .{
928 .flags = .{ .NUMERICSERV = true },927 .flags = .{ .NUMERICSERV = true },
929 .family = posix.AF.UNSPEC,928 .family = posix.AF.UNSPEC,
...@@ -935,8 +934,8 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get...@@ -935,8 +934,8 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get
935 .next = null,934 .next = null,
936 };935 };
937 var res: ?*posix.addrinfo = null;936 var res: ?*posix.addrinfo = null;
938 switch (sys.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res)) {937 switch (posix.system.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res)) {
939 @as(sys.EAI, @enumFromInt(0)) => {},938 @as(posix.system.EAI, @enumFromInt(0)) => {},
940 .ADDRFAMILY => return error.HostLacksNetworkAddresses,939 .ADDRFAMILY => return error.HostLacksNetworkAddresses,
941 .AGAIN => return error.TemporaryNameServerFailure,940 .AGAIN => return error.TemporaryNameServerFailure,
942 .BADFLAGS => unreachable, // Invalid hints941 .BADFLAGS => unreachable, // Invalid hints
...@@ -952,7 +951,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get...@@ -952,7 +951,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get
952 },951 },
953 else => unreachable,952 else => unreachable,
954 }953 }
955 defer if (res) |some| sys.freeaddrinfo(some);954 defer if (res) |some| posix.system.freeaddrinfo(some);
956955
957 const addr_count = blk: {956 const addr_count = blk: {
958 var count: usize = 0;957 var count: usize = 0;