ruby-changes:11028
From: shyouhei <ko1@a...>
Date: Wed, 25 Feb 2009 15:06:25 +0900 (JST)
Subject: [ruby-changes:11028] Ruby:r22619 (ruby_1_8_7): merge revision(s) 21505:
shyouhei 2009-02-25 15:06:08 +0900 (Wed, 25 Feb 2009) New Revision: 22619 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22619 Log: merge revision(s) 21505: * ext/socket/extconf.rb (gai_strerror): checks if available and if returns const pointer. * ext/socket/getaddrinfo.c (gai_strerror): defines only if non available. [ruby-core:21328] Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/ext/socket/extconf.rb branches/ruby_1_8_7/ext/socket/getaddrinfo.c branches/ruby_1_8_7/version.h Index: ruby_1_8_7/ext/socket/getaddrinfo.c =================================================================== --- ruby_1_8_7/ext/socket/getaddrinfo.c (revision 22618) +++ ruby_1_8_7/ext/socket/getaddrinfo.c (revision 22619) @@ -39,6 +39,9 @@ */ #include "config.h" +#ifdef RUBY_EXTCONF_H +#include RUBY_EXTCONF_H +#endif #include <sys/types.h> #if !defined(_WIN32) && !defined(__VMS) #include <sys/param.h> @@ -199,7 +202,8 @@ #define ERR(err) { error = (err); goto bad; } -#if defined __UCLIBC__ +#ifndef HAVE_GAI_STRERROR +#ifdef GAI_STRERROR_CONST const #endif char * @@ -210,6 +214,7 @@ ecode = EAI_MAX; return (char *)ai_errlist[ecode]; } +#endif void freeaddrinfo(ai) @@ -388,7 +393,7 @@ port = htons((unsigned short)atoi(servname)); } else { struct servent *sp; - char *proto; + const char *proto; proto = NULL; switch (pai->ai_socktype) { Index: ruby_1_8_7/ext/socket/extconf.rb =================================================================== --- ruby_1_8_7/ext/socket/extconf.rb (revision 22618) +++ ruby_1_8_7/ext/socket/extconf.rb (revision 22619) @@ -259,6 +259,19 @@ have_func("inet_ntop") or have_func("inet_ntoa") have_func("inet_pton") or have_func("inet_aton") have_func("getservbyport") + if have_func("gai_strerror") + unless checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)} +#{cpp_include(headers)} +#include <stdlib.h> +void +conftest_gai_strerror_is_const() +{ + *gai_strerror(0) = 0; +} +EOF + $defs << "-DGAI_STRERROR_CONST" + end + end have_header("arpa/nameser.h") have_header("resolv.h") end Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 22618) +++ ruby_1_8_7/ChangeLog (revision 22619) @@ -1,3 +1,11 @@ +Wed Feb 25 15:05:48 2009 Nobuyoshi Nakada <nobu@r...> + + * ext/socket/extconf.rb (gai_strerror): checks if available and if + returns const pointer. + + * ext/socket/getaddrinfo.c (gai_strerror): defines only if non + available. [ruby-core:21328] + Wed Feb 25 14:57:18 2009 Nobuyoshi Nakada <nobu@r...> * win32/win32.c (open_dir_handle): extracted from rb_w32_opendir. Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 22618) +++ ruby_1_8_7/version.h (revision 22619) @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2009-02-25" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20090225 -#define RUBY_PATCHLEVEL 142 +#define RUBY_PATCHLEVEL 143 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/