X-Git-Url: https://git.librecmc.org/?p=oweals%2Ftinc.git;a=blobdiff_plain;f=src%2Fnetutl.c;h=1ec6e5a82199548254b3f3c3813082ef7b47e544;hp=cd50792feafed8502b4c36ca9ce127419c80e452;hb=721e4caee0f7c6e003c297c95fb6d93bd4102219;hpb=586f15ed20682413d1bddbb4518dd2714c96b255 diff --git a/src/netutl.c b/src/netutl.c index cd50792..1ec6e5a 100644 --- a/src/netutl.c +++ b/src/netutl.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: netutl.c,v 1.12.4.49 2003/07/24 12:08:15 guus Exp $ + $Id: netutl.c,v 1.12.4.50 2003/07/29 22:59:00 guus Exp $ */ #include "system.h" @@ -36,16 +36,15 @@ bool hostnames = false; */ struct addrinfo *str2addrinfo(const char *address, const char *service, int socktype) { - struct addrinfo hint, *ai; + struct addrinfo *ai; + struct addrinfo hint = { + .ai_family = addressfamily, + .ai_socktype = socktype, + }; int err; cp(); - memset(&hint, 0, sizeof(hint)); - - hint.ai_family = addressfamily; - hint.ai_socktype = socktype; - err = getaddrinfo(address, service, &hint, &ai); if(err) { @@ -59,18 +58,17 @@ struct addrinfo *str2addrinfo(const char *address, const char *service, int sock sockaddr_t str2sockaddr(const char *address, const char *port) { - struct addrinfo hint, *ai; + struct addrinfo *ai; + struct addrinfo hint = { + .ai_family = AF_UNSPEC, + .ai_flags = AI_NUMERICHOST, + .ai_socktype = SOCK_STREAM, + }; sockaddr_t result; int err; cp(); - memset(&hint, 0, sizeof(hint)); - - hint.ai_family = AF_UNSPEC; - hint.ai_flags = AI_NUMERICHOST; - hint.ai_socktype = SOCK_STREAM; - err = getaddrinfo(address, port, &hint, &ai); if(err || !ai) {