Skip to content

Commit

Permalink
Use posix.addrinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
g41797 committed Oct 2, 2024
1 parent 2423ecb commit a6710aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions network.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ pub fn getEndpointList(allocator: std.mem.Allocator, name: []const u8, port: u16
if (builtin.link_libc or is_windows) {
const getaddrinfo_fn = if (is_windows) windows.getaddrinfo else libc_getaddrinfo;
const freeaddrinfo_fn = if (is_windows) windows.funcs.freeaddrinfo else std.posix.system.freeaddrinfo;
const addrinfo = if (is_windows) windows.addrinfo else std.posix.addrinfo;
//const addrinfo = if (is_windows) windows.addrinfo else std.posix.addrinfo;

const name_c = try allocator.dupeZ(u8, name);
defer allocator.free(name_c);
Expand All @@ -1283,7 +1283,7 @@ pub fn getEndpointList(allocator: std.mem.Allocator, name: []const u8, port: u16

const addr_count = blk: {
var count: usize = 0;
var it: ?*addrinfo = res;
var it: ?*posix.addrinfo = res;
while (it) |info| : (it = info.next) {
if (info.addr != null) {
count += 1;
Expand All @@ -1293,7 +1293,7 @@ pub fn getEndpointList(allocator: std.mem.Allocator, name: []const u8, port: u16
};
result.endpoints = try arena.alloc(EndPoint, addr_count);

var it: ?*addrinfo = res;
var it: ?*posix.addrinfo = res;
var i: usize = 0;
while (it) |info| : (it = info.next) {
const sockaddr = info.addr orelse continue;
Expand Down

0 comments on commit a6710aa

Please sign in to comment.