ruby-changes:9964
From: nobu <ko1@a...>
Date: Wed, 14 Jan 2009 13:09:35 +0900 (JST)
Subject: [ruby-changes:9964] Ruby:r21505 (ruby_1_8, trunk): * ext/socket/extconf.rb (gai_strerror): checks if available and if
nobu 2009-01-14 13:09:05 +0900 (Wed, 14 Jan 2009) New Revision: 21505 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21505 Log: * 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/ChangeLog branches/ruby_1_8/ext/socket/extconf.rb branches/ruby_1_8/ext/socket/getaddrinfo.c branches/ruby_1_8/version.h trunk/ChangeLog trunk/ext/socket/extconf.rb trunk/ext/socket/getaddrinfo.c Index: ChangeLog =================================================================== --- ChangeLog (revision 21504) +++ ChangeLog (revision 21505) @@ -1,3 +1,11 @@ +Wed Jan 14 13:09:00 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 Jan 14 12:39:16 2009 Nobuyoshi Nakada <nobu@r...> * io.c (rb_io_wait_readable, rb_io_wait_writable): need rb_fd_ptr. Index: ext/socket/getaddrinfo.c =================================================================== --- ext/socket/getaddrinfo.c (revision 21504) +++ ext/socket/getaddrinfo.c (revision 21505) @@ -39,6 +39,9 @@ */ #include "ruby/config.h" +#ifdef RUBY_EXTCONF_H +#include RUBY_EXTCONF_H +#endif #include <sys/types.h> #ifndef _WIN32 #include <sys/param.h> @@ -195,8 +198,8 @@ #define ERR(err) { error = (err); goto bad; } -#ifndef __HAIKU__ -#if defined __UCLIBC__ +#ifndef HAVE_GAI_STRERROR +#ifdef GAI_STRERROR_CONST const #endif char * Index: ext/socket/extconf.rb =================================================================== --- ext/socket/extconf.rb (revision 21504) +++ ext/socket/extconf.rb (revision 21505) @@ -255,6 +255,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/ext/socket/getaddrinfo.c =================================================================== --- ruby_1_8/ext/socket/getaddrinfo.c (revision 21504) +++ ruby_1_8/ext/socket/getaddrinfo.c (revision 21505) @@ -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/ext/socket/extconf.rb =================================================================== --- ruby_1_8/ext/socket/extconf.rb (revision 21504) +++ ruby_1_8/ext/socket/extconf.rb (revision 21505) @@ -261,6 +261,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/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 21504) +++ ruby_1_8/ChangeLog (revision 21505) @@ -1,3 +1,11 @@ +Wed Jan 14 13:09:00 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] + Tue Jan 13 00:57:56 2009 Tanaka Akira <akr@f...> * ext/socket/socket.c (sock_s_unpack_sockaddr_in): check too short Index: ruby_1_8/version.h =================================================================== --- ruby_1_8/version.h (revision 21504) +++ ruby_1_8/version.h (revision 21505) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.7" -#define RUBY_RELEASE_DATE "2009-01-13" +#define RUBY_RELEASE_DATE "2009-01-14" #define RUBY_VERSION_CODE 187 -#define RUBY_RELEASE_CODE 20090113 +#define RUBY_RELEASE_CODE 20090114 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 7 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 13 +#define RUBY_RELEASE_DAY 14 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/