From 97d72b4dfeecc69f3a9bbc8112ad027af3d11752 Mon Sep 17 00:00:00 2001 From: Kp Date: Fri, 4 Jul 2014 03:57:34 +0000 Subject: [PATCH] List initialize UDP hints --- similar/main/net_udp.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/similar/main/net_udp.cpp b/similar/main/net_udp.cpp index f153aec65..df23084bd 100644 --- a/similar/main/net_udp.cpp +++ b/similar/main/net_udp.cpp @@ -168,7 +168,7 @@ static void udp_traffic_stat() static int udp_dns_filladdr(const char *host, int port, struct _sockaddr &sAddr) { // Variables - struct addrinfo *result, hints; + struct addrinfo *result, hints{}; char sPort[6]; // Zero out the target first @@ -176,9 +176,6 @@ static int udp_dns_filladdr(const char *host, int port, struct _sockaddr &sAddr) // Build the port snprintf( sPort, 6, "%d", port ); - // Set up hints - memset( &hints, 0, sizeof( hints ) ); - // Uncomment the following if we want ONLY what we compile for // hints.ai_family = _af; @@ -270,11 +267,10 @@ static int udp_open_socket(int socknum, int port) } (void)setsockopt( UDP_Socket[socknum], SOL_SOCKET, SO_BROADCAST, (const char *) &bcast, sizeof(bcast) ); #else - struct addrinfo hints,*res,*sres; + struct addrinfo hints{},*res,*sres; int err,ai_family_; char cport[6]; - memset (&hints, '\0', sizeof (struct addrinfo)); memset(cport,'\0',sizeof(char)*6); hints.ai_flags = AI_PASSIVE;