1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net: use vmemset(&hints, 0, int(sizeof(hints))), instead of zeroing the fields 1 by 1

This commit is contained in:
Delyan Angelov 2021-11-24 09:34:48 +02:00
parent e42db5bee2
commit 8e0de2036d
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -173,14 +173,11 @@ pub fn resolve_ipaddrs(addr string, family AddrFamily, typ SocketType) ?[]Addr {
// ai_socktype: int(typ)
// ai_flags: C.AI_PASSIVE
}
unsafe { vmemset(&hints, 0, int(sizeof(hints))) }
hints.ai_family = int(family)
hints.ai_socktype = int(typ)
hints.ai_flags = C.AI_PASSIVE
hints.ai_protocol = 0
hints.ai_addrlen = 0
hints.ai_addr = voidptr(0)
hints.ai_canonname = voidptr(0)
hints.ai_next = voidptr(0)
results := &C.addrinfo(0)
sport := '$port'