diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-23 01:29:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-02-23 01:29:25 +0000 |
commit | 95be5381ec208d25ef8489cad9e19795af5ed39f (patch) | |
tree | 700a0868528a5a6699093ade67370e306bd142a5 /ext | |
parent | 7490f69117692d5d9de7dc7f3bcae87466653fbd (diff) | |
download | ruby-95be5381ec208d25ef8489cad9e19795af5ed39f.tar.gz |
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
Diffstat (limited to 'ext')
-rw-r--r-- | ext/socket/raddrinfo.c | 20 |
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; |