From 8e0de2036d211e5f96f3b9fc71e8617a434c4640 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 24 Nov 2021 09:34:48 +0200 Subject: [PATCH] net: use `vmemset(&hints, 0, int(sizeof(hints)))`, instead of zeroing the fields 1 by 1 --- vlib/net/address.v | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vlib/net/address.v b/vlib/net/address.v index 23bb9c3ad6..cb41eed8a3 100644 --- a/vlib/net/address.v +++ b/vlib/net/address.v @@ -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'