summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-23 01:29:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-23 01:29:25 +0000
commit95be5381ec208d25ef8489cad9e19795af5ed39f (patch)
tree700a0868528a5a6699093ade67370e306bd142a5
parent7490f69117692d5d9de7dc7f3bcae87466653fbd (diff)
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
-rw-r--r--ext/socket/raddrinfo.c20
1 files changed, 9 insertions, 11 deletions
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;