From aa8e9c63ad0300df0eed07c3fe4f19d859a63673 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 2 Aug 2016 03:37:02 +0000 Subject: 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 --- ext/socket/getnameinfo.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'ext/socket/getnameinfo.c') 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) { -- cgit v1.2.3