ruby-changes:43853
From: usa <ko1@a...>
Date: Tue, 16 Aug 2016 14:03:26 +0900 (JST)
Subject: [ruby-changes:43853] usa:r55926 (ruby_2_2): merge revision(s) 55797: [Backport #12645]
usa 2016-08-16 14:03:20 +0900 (Tue, 16 Aug 2016) New Revision: 55926 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55926 Log: merge revision(s) 55797: [Backport #12645] * ext/socket/option.c, ext/socket/rubysocket.h (inet_ntop): share the fallback definition. [ruby-core:76646] [Bug #12645] Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/ext/socket/getnameinfo.c branches/ruby_2_2/ext/socket/option.c branches/ruby_2_2/ext/socket/rubysocket.h branches/ruby_2_2/version.h Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 55925) +++ ruby_2_2/version.h (revision 55926) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.6" #define RUBY_RELEASE_DATE "2016-08-16" -#define RUBY_PATCHLEVEL 354 +#define RUBY_PATCHLEVEL 355 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_2/ext/socket/option.c =================================================================== --- ruby_2_2/ext/socket/option.c (revision 55925) +++ ruby_2_2/ext/socket/option.c (revision 55926) @@ -648,7 +648,7 @@ inspect_timeval_as_interval(int level, i https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/option.c#L648 */ #if !defined HAVE_INET_NTOP && ! defined _WIN32 -static const char * +const char * inet_ntop(int af, const void *addr, char *numaddr, size_t numaddr_len) { #ifdef HAVE_INET_NTOA @@ -663,10 +663,6 @@ inet_ntop(int af, const void *addr, char https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/option.c#L663 #endif return numaddr; } -#elif defined __MINGW32__ -# define inet_ntop(f,a,n,l) rb_w32_inet_ntop(f,a,n,l) -#elif defined _MSC_VER && RUBY_MSVCRT_VERSION < 90 -const char *WSAAPI inet_ntop(int, const void *, char *, size_t); #endif /* Although the buffer size needed depends on the prefixes, "%u" may generate "4294967295". */ Index: ruby_2_2/ext/socket/getnameinfo.c =================================================================== --- ruby_2_2/ext/socket/getnameinfo.c (revision 55925) +++ ruby_2_2/ext/socket/getnameinfo.c (revision 55926) @@ -118,24 +118,6 @@ static struct afd { https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/getnameinfo.c#L118 #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) { Index: ruby_2_2/ext/socket/rubysocket.h =================================================================== --- ruby_2_2/ext/socket/rubysocket.h (revision 55925) +++ ruby_2_2/ext/socket/rubysocket.h (revision 55926) @@ -412,4 +412,12 @@ static inline void rsock_maybe_wait_fd(i https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/socket/rubysocket.h#L412 # define rsock_maybe_wait_fd(fd) rb_thread_wait_fd((fd)) #endif +#if !defined HAVE_INET_NTOP && ! defined _WIN32 +const char *inet_ntop(int, const void *, char *, size_t); +#elif defined __MINGW32__ +# define inet_ntop(f,a,n,l) rb_w32_inet_ntop(f,a,n,l) +#elif defined _MSC_VER && RUBY_MSVCRT_VERSION < 90 +const char *WSAAPI inet_ntop(int, const void *, char *, size_t); +#endif + #endif Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 55925) +++ ruby_2_2/ChangeLog (revision 55926) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Tue Aug 16 13:59:34 2016 Nobuyoshi Nakada <nobu@r...> + + * ext/socket/option.c, ext/socket/rubysocket.h (inet_ntop): share + the fallback definition. [ruby-core:76646] [Bug #12645] + Tue Aug 16 13:52:42 2016 Nobuyoshi Nakada <nobu@r...> * vm.c (vm_set_main_stack): remove unnecessary check. toplevel Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r55797 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/