From 95be5381ec208d25ef8489cad9e19795af5ed39f Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 23 Feb 2014 01:29:25 +0000 Subject: raddrinfo.c: suppress warnings * ext/socket/raddrinfo.c (numeric_getaddrinfo): move conditionally used variables inside the block, to suppress warnings on platforms where inet_pton() is not available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/raddrinfo.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'ext/socket/raddrinfo.c') diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index 6863dfd942..ee494e600b 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -176,19 +176,17 @@ numeric_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) { - static const struct { - int socktype; - int protocol; - } list[] = { - { SOCK_STREAM, IPPROTO_TCP }, - { SOCK_DGRAM, IPPROTO_UDP }, - { SOCK_RAW, 0 } - }; - - struct addrinfo *ai = NULL; - #ifdef HAVE_INET_PTON if (node && (!service || strspn(service, "0123456789") == strlen(service))) { + static const struct { + int socktype; + int protocol; + } list[] = { + { SOCK_STREAM, IPPROTO_TCP }, + { SOCK_DGRAM, IPPROTO_UDP }, + { SOCK_RAW, 0 } + }; + struct addrinfo *ai = NULL; int port = service ? (unsigned short)atoi(service): 0; int hint_family = hints ? hints->ai_family : PF_UNSPEC; int hint_socktype = hints ? hints->ai_socktype : 0; -- cgit v1.2.3