diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-02 03:37:02 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-02 03:37:02 +0000 |
commit | aa8e9c63ad0300df0eed07c3fe4f19d859a63673 (patch) | |
tree | 2404e5ccba3223b54eaea524eb9b6408450726d5 /ext/socket/getnameinfo.c | |
parent | f65180025b0055e1d28f24b97a438e3c6c1a6ed9 (diff) |
socket/option.c: inet_ntop
* ext/socket/option.c, ext/socket/rubysocket.h (inet_ntop): share
the fallback definition. [ruby-core:76646] [Bug #12645]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/getnameinfo.c')
-rw-r--r-- | ext/socket/getnameinfo.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c index bca97acc1f..b7e75f7d27 100644 --- a/ext/socket/getnameinfo.c +++ b/ext/socket/getnameinfo.c @@ -117,24 +117,6 @@ static struct afd { #define ENI_FAMILY 5 #define ENI_SALEN 6 -#ifndef HAVE_INET_NTOP -static const char * -inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len) -{ -#ifdef HAVE_INET_NTOA - struct in_addr in; - memcpy(&in.s_addr, addr, sizeof(in.s_addr)); - snprintf(numaddr, numaddr_len, "%s", inet_ntoa(in)); -#else - unsigned long x = ntohl(*(unsigned long*)addr); - snprintf(numaddr, numaddr_len, "%d.%d.%d.%d", - (int) (x>>24) & 0xff, (int) (x>>16) & 0xff, - (int) (x>> 8) & 0xff, (int) (x>> 0) & 0xff); -#endif - return numaddr; -} -#endif - int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags) { |