mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
7490f69117
commit
95be5381ec
1 changed files with 9 additions and 11 deletions
|
@ -176,6 +176,8 @@ numeric_getaddrinfo(const char *node, const char *service,
|
||||||
const struct addrinfo *hints,
|
const struct addrinfo *hints,
|
||||||
struct addrinfo **res)
|
struct addrinfo **res)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_INET_PTON
|
||||||
|
if (node && (!service || strspn(service, "0123456789") == strlen(service))) {
|
||||||
static const struct {
|
static const struct {
|
||||||
int socktype;
|
int socktype;
|
||||||
int protocol;
|
int protocol;
|
||||||
|
@ -184,11 +186,7 @@ numeric_getaddrinfo(const char *node, const char *service,
|
||||||
{ SOCK_DGRAM, IPPROTO_UDP },
|
{ SOCK_DGRAM, IPPROTO_UDP },
|
||||||
{ SOCK_RAW, 0 }
|
{ SOCK_RAW, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct addrinfo *ai = NULL;
|
struct addrinfo *ai = NULL;
|
||||||
|
|
||||||
#ifdef HAVE_INET_PTON
|
|
||||||
if (node && (!service || strspn(service, "0123456789") == strlen(service))) {
|
|
||||||
int port = service ? (unsigned short)atoi(service): 0;
|
int port = service ? (unsigned short)atoi(service): 0;
|
||||||
int hint_family = hints ? hints->ai_family : PF_UNSPEC;
|
int hint_family = hints ? hints->ai_family : PF_UNSPEC;
|
||||||
int hint_socktype = hints ? hints->ai_socktype : 0;
|
int hint_socktype = hints ? hints->ai_socktype : 0;
|
||||||
|
|
Loading…
Reference in a new issue