ruby-changes:11570
From: akr <ko1@a...>
Date: Sat, 18 Apr 2009 23:10:29 +0900 (JST)
Subject: [ruby-changes:11570] Ruby:r23204 (trunk): * ext/readline/readline.c: use rb_f_notimplement for methods not
akr 2009-04-18 23:10:06 +0900 (Sat, 18 Apr 2009) New Revision: 23204 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23204 Log: * ext/readline/readline.c: use rb_f_notimplement for methods not implemented. * ext/openssl/ossl_engine.c: ditto. * ext/openssl/ossl_config.c: ditto. * ext/openssl/ossl_cipher.c: ditto. * ext/openssl/ossl_pkcs5.c: ditto. * ext/openssl/ossl_x509ext.c: ditto. * ext/socket/socket.c: ditto. * ext/socket/basicsocket.c: ditto. * ext/socket/ancdata.c: ditto. * ext/socket/unixsocket.c: ditto. * ext/iconv/iconv.c: ditto. Modified files: trunk/ChangeLog trunk/ext/iconv/iconv.c trunk/ext/openssl/ossl_cipher.c trunk/ext/openssl/ossl_config.c trunk/ext/openssl/ossl_engine.c trunk/ext/openssl/ossl_pkcs5.c trunk/ext/openssl/ossl_x509ext.c trunk/ext/readline/readline.c trunk/ext/socket/ancdata.c trunk/ext/socket/basicsocket.c trunk/ext/socket/socket.c trunk/ext/socket/unixsocket.c trunk/process.c Index: ChangeLog =================================================================== --- ChangeLog (revision 23203) +++ ChangeLog (revision 23204) @@ -1,3 +1,28 @@ +Sat Apr 18 23:07:18 2009 Tanaka Akira <akr@f...> + + * ext/readline/readline.c: use rb_f_notimplement for methods not + implemented. + + * ext/openssl/ossl_engine.c: ditto. + + * ext/openssl/ossl_config.c: ditto. + + * ext/openssl/ossl_cipher.c: ditto. + + * ext/openssl/ossl_pkcs5.c: ditto. + + * ext/openssl/ossl_x509ext.c: ditto. + + * ext/socket/socket.c: ditto. + + * ext/socket/basicsocket.c: ditto. + + * ext/socket/ancdata.c: ditto. + + * ext/socket/unixsocket.c: ditto. + + * ext/iconv/iconv.c: ditto. + Sat Apr 18 21:07:34 2009 Tanaka Akira <akr@f...> * ext/curses/curses.c: use rb_f_notimplement for methods not Index: process.c =================================================================== --- process.c (revision 23203) +++ process.c (revision 23204) @@ -3304,7 +3304,7 @@ /* this confusion. */ #ifdef HAVE_SETPGID if (setpgid(0,0) < 0) rb_sys_fail(0); -#else /* defined(HAVE_SETPGRP) && defined(SETPGRP_VOID) */ +#elif defined(HAVE_SETPGRP) && defined(SETPGRP_VOID) if (setpgrp() < 0) rb_sys_fail(0); #endif return INT2FIX(0); @@ -3388,7 +3388,7 @@ pid = setsid(); if (pid < 0) rb_sys_fail(0); return PIDT2NUM(pid); -#else /* defined(HAVE_SETPGRP) && defined(TIOCNOTTY) */ +#elif defined(HAVE_SETPGRP) && defined(TIOCNOTTY) rb_pid_t pid; int ret; @@ -4538,7 +4538,7 @@ after_fork(); if (n < 0) rb_sys_fail("daemon"); return INT2FIX(n); -#else /* defined(HAVE_FORK) */ +#elif defined(HAVE_FORK) switch (rb_fork(0, 0, 0, Qnil)) { case -1: return (-1); Index: ext/readline/readline.c =================================================================== --- ext/readline/readline.c (revision 23203) +++ ext/readline/readline.c (revision 23204) @@ -436,6 +436,7 @@ return result; } +#ifdef HAVE_RL_SET_SCREEN_SIZE /* * call-seq: * Readline.set_screen_size(rows, columns) -> self @@ -451,16 +452,15 @@ static VALUE readline_s_set_screen_size(VALUE self, VALUE rows, VALUE columns) { -#ifdef HAVE_RL_SET_SCREEN_SIZE rb_secure(4); rl_set_screen_size(NUM2INT(rows), NUM2INT(columns)); return self; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_SET_SCREEN_SIZE */ } +#else +#define readline_s_set_screen_size rb_f_notimplement +#endif +#ifdef HAVE_RL_GET_SCREEN_SIZE /* * call-seq: * Readline.get_screen_size -> [rows, columns] @@ -476,7 +476,6 @@ static VALUE readline_s_get_screen_size(VALUE self) { -#ifdef HAVE_RL_GET_SCREEN_SIZE int rows, columns; VALUE res; @@ -486,12 +485,12 @@ rb_ary_push(res, INT2NUM(rows)); rb_ary_push(res, INT2NUM(columns)); return res; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_GET_SCREEN_SIZE */ } +#else +#define readline_s_get_screen_size rb_f_notimplement +#endif +#ifdef HAVE_RL_VI_EDITING_MODE /* * call-seq: * Readline.vi_editing_mode -> nil @@ -506,16 +505,15 @@ static VALUE readline_s_vi_editing_mode(VALUE self) { -#ifdef HAVE_RL_VI_EDITING_MODE rb_secure(4); rl_vi_editing_mode(1,0); return Qnil; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_VI_EDITING_MODE */ } +#else +#define readline_s_vi_editing_mode rb_f_notimplement +#endif +#ifdef HAVE_RL_EDITING_MODE /* * call-seq: * Readline.vi_editing_mode? -> bool @@ -529,15 +527,14 @@ static VALUE readline_s_vi_editing_mode_p(VALUE self) { -#ifdef HAVE_RL_EDITING_MODE rb_secure(4); return rl_editing_mode == 0 ? Qtrue : Qfalse; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_EDITING_MODE */ } +#else +#define readline_s_vi_editing_mode_p rb_f_notimplement +#endif +#ifdef HAVE_RL_EMACS_EDITING_MODE /* * call-seq: * Readline.emacs_editing_mode -> nil @@ -552,16 +549,15 @@ static VALUE readline_s_emacs_editing_mode(VALUE self) { -#ifdef HAVE_RL_EMACS_EDITING_MODE rb_secure(4); rl_emacs_editing_mode(1,0); return Qnil; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_EMACS_EDITING_MODE */ } +#else +#define readline_s_emacs_editing_mode rb_f_notimplement +#endif +#ifdef HAVE_RL_EDITING_MODE /* * call-seq: * Readline.emacs_editing_mode? -> bool @@ -575,15 +571,14 @@ static VALUE readline_s_emacs_editing_mode_p(VALUE self) { -#ifdef HAVE_RL_EDITING_MODE rb_secure(4); return rl_editing_mode == 1 ? Qtrue : Qfalse; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_EDITING_MODE */ } +#else +#define readline_s_emacs_editing_mode_p rb_f_notimplement +#endif +#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER /* * call-seq: * Readline.completion_append_character = char @@ -625,7 +620,6 @@ static VALUE readline_s_set_completion_append_character(VALUE self, VALUE str) { -#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER rb_secure(4); if (NIL_P(str)) { rl_completion_append_character = '\0'; @@ -639,12 +633,12 @@ } } return self; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_COMPLETION_APPEND_CHARACTER */ } +#else +#define readline_s_set_completion_append_character rb_f_notimplement +#endif +#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER /* * call-seq: * Readline.completion_append_character -> char @@ -659,7 +653,6 @@ static VALUE readline_s_get_completion_append_character(VALUE self) { -#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER char buf[1]; rb_secure(4); @@ -668,12 +661,12 @@ buf[0] = (char) rl_completion_append_character; return rb_locale_str_new(buf, 1); -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_COMPLETION_APPEND_CHARACTER */ } +#else +#define readline_s_get_completion_append_character rb_f_notimplement +#endif +#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS /* * call-seq: * Readline.basic_word_break_characters = string @@ -689,7 +682,6 @@ static VALUE readline_s_set_basic_word_break_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS static char *basic_word_break_characters = NULL; rb_secure(4); @@ -706,12 +698,12 @@ basic_word_break_characters[RSTRING_LEN(str)] = '\0'; rl_basic_word_break_characters = basic_word_break_characters; return self; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_BASIC_WORD_BREAK_CHARACTERS */ } +#else +#define readline_s_set_basic_word_break_characters rb_f_notimplement +#endif +#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS /* * call-seq: * Readline.basic_word_break_characters -> string @@ -726,17 +718,16 @@ static VALUE readline_s_get_basic_word_break_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS rb_secure(4); if (rl_basic_word_break_characters == NULL) return Qnil; return rb_locale_str_new_cstr(rl_basic_word_break_characters); -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_BASIC_WORD_BREAK_CHARACTERS */ } +#else +#define readline_s_get_basic_word_break_characters rb_f_notimplement +#endif +#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS /* * call-seq: * Readline.completer_word_break_characters = string @@ -752,7 +743,6 @@ static VALUE readline_s_set_completer_word_break_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS static char *completer_word_break_characters = NULL; rb_secure(4); @@ -769,12 +759,12 @@ completer_word_break_characters[RSTRING_LEN(str)] = '\0'; rl_completer_word_break_characters = completer_word_break_characters; return self; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS */ } +#else +#define readline_s_set_completer_word_break_characters rb_f_notimplement +#endif +#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS /* * call-seq: * Readline.completer_word_break_characters -> string @@ -789,17 +779,16 @@ static VALUE readline_s_get_completer_word_break_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS rb_secure(4); if (rl_completer_word_break_characters == NULL) return Qnil; return rb_locale_str_new_cstr(rl_completer_word_break_characters); -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS */ } +#else +#define readline_s_get_completer_word_break_characters rb_f_notimplement +#endif +#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS /* * call-seq: * Readline.basic_quote_characters = string @@ -813,7 +802,6 @@ static VALUE readline_s_set_basic_quote_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS static char *basic_quote_characters = NULL; rb_secure(4); @@ -831,12 +819,12 @@ rl_basic_quote_characters = basic_quote_characters; return self; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_BASIC_QUOTE_CHARACTERS */ } +#else +#define readline_s_set_basic_quote_characters rb_f_notimplement +#endif +#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS /* * call-seq: * Readline.basic_quote_characters -> string @@ -850,17 +838,16 @@ static VALUE readline_s_get_basic_quote_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS rb_secure(4); if (rl_basic_quote_characters == NULL) return Qnil; return rb_locale_str_new_cstr(rl_basic_quote_characters); -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_BASIC_QUOTE_CHARACTERS */ } +#else +#define readline_s_get_basic_quote_characters rb_f_notimplement +#endif +#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS /* * call-seq: * Readline.completer_quote_characters = string @@ -877,7 +864,6 @@ static VALUE readline_s_set_completer_quote_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS static char *completer_quote_characters = NULL; rb_secure(4); @@ -894,12 +880,12 @@ rl_completer_quote_characters = completer_quote_characters; return self; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_COMPLETER_QUOTE_CHARACTERS */ } +#else +#define readline_s_set_completer_quote_characters rb_f_notimplement +#endif +#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS /* * call-seq: * Readline.completer_quote_characters -> string @@ -914,17 +900,16 @@ static VALUE readline_s_get_completer_quote_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS rb_secure(4); if (rl_completer_quote_characters == NULL) return Qnil; return rb_locale_str_new_cstr(rl_completer_quote_characters); -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_COMPLETER_QUOTE_CHARACTERS */ } +#else +#define readline_s_get_completer_quote_characters rb_f_notimplement +#endif +#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS /* * call-seq: * Readline.filename_quote_characters = string @@ -939,7 +924,6 @@ static VALUE readline_s_set_filename_quote_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS static char *filename_quote_characters = NULL; rb_secure(4); @@ -956,12 +940,12 @@ rl_filename_quote_characters = filename_quote_characters; return self; -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */ } +#else +#define readline_s_set_filename_quote_characters rb_f_notimplement +#endif +#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS /* * call-seq: * Readline.filename_quote_characters -> string @@ -976,16 +960,14 @@ static VALUE readline_s_get_filename_quote_characters(VALUE self, VALUE str) { -#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS rb_secure(4); if (rl_filename_quote_characters == NULL) return Qnil; return rb_locale_str_new_cstr(rl_filename_quote_characters); -#else - rb_notimplement(); - return Qnil; /* not reached */ -#endif /* HAVE_RL_FILENAME_QUOTE_CHARACTERS */ } +#else +#define readline_s_get_filename_quote_characters rb_f_notimplement +#endif static VALUE hist_to_s(VALUE self) @@ -1025,10 +1007,10 @@ return rb_locale_str_new_cstr(entry->line); } +#ifdef HAVE_REPLACE_HISTORY_ENTRY static VALUE hist_set(VALUE self, VALUE index, VALUE str) { -#ifdef HAVE_REPLACE_HISTORY_ENTRY HIST_ENTRY *entry = NULL; int i; @@ -1045,11 +1027,10 @@ rb_raise(rb_eIndexError, "invalid index"); } return str; +} #else - rb_notimplement(); - return Qnil; /* not reached */ +#define hist_set rb_f_notimplement #endif -} static VALUE hist_push(VALUE self, VALUE str) @@ -1165,18 +1146,17 @@ return rb_remove_history(i); } +#ifdef HAVE_CLEAR_HISTORY static VALUE hist_clear(VALUE self) { -#ifdef HAVE_CLEAR_HISTORY rb_secure(4); clear_history(); return self; +} #else - rb_notimplement(); - return Qnil; /* not reached */ +#define hist_clear rb_f_notimplement #endif -} static VALUE filename_completion_proc_call(VALUE self, VALUE str) Index: ext/openssl/ossl_engine.c =================================================================== --- ext/openssl/ossl_engine.c (revision 23203) +++ ext/openssl/ossl_engine.c (revision 23204) @@ -166,10 +166,10 @@ return Qnil; } +#if defined(HAVE_ENGINE_GET_CIPHER) static VALUE ossl_engine_get_cipher(VALUE self, VALUE name) { -#if defined(HAVE_ENGINE_GET_CIPHER) ENGINE *e; const EVP_CIPHER *ciph, *tmp; char *s; @@ -184,15 +184,15 @@ if(!ciph) ossl_raise(eEngineError, NULL); return ossl_cipher_new(ciph); +} #else - rb_notimplement(); +#define ossl_engine_get_cipher rb_f_notimplement #endif -} +#if defined(HAVE_ENGINE_GET_DIGEST) static VALUE ossl_engine_get_digest(VALUE self, VALUE name) { -#if defined(HAVE_ENGINE_GET_DIGEST) ENGINE *e; const EVP_MD *md, *tmp; char *s; @@ -207,10 +207,10 @@ if(!md) ossl_raise(eEngineError, NULL); return ossl_digest_new(md); +} #else - rb_notimplement(); +#define ossl_engine_get_digest rb_f_notimplement #endif -} static VALUE ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self) Index: ext/openssl/ossl_config.c =================================================================== --- ext/openssl/ossl_config.c (revision 23203) +++ ext/openssl/ossl_config.c (revision 23204) @@ -192,7 +192,17 @@ #endif } +#if !defined(OSSL_NO_CONF_API) static VALUE +ossl_config_add_value_m(VALUE self, VALUE section, VALUE name, VALUE value) +{ + return ossl_config_add_value(self, section, name, value); +} +#else +#define ossl_config_add_value_m rb_f_notimplement +#endif + +static VALUE ossl_config_get_value(VALUE self, VALUE section, VALUE name) { CONF *conf; @@ -456,7 +466,7 @@ rb_define_method(cConfig, "initialize", ossl_config_initialize, -1); rb_define_method(cConfig, "get_value", ossl_config_get_value, 2); rb_define_method(cConfig, "value", ossl_config_get_value_old, -1); - rb_define_method(cConfig, "add_value", ossl_config_add_value, 3); + rb_define_method(cConfig, "add_value", ossl_config_add_value_m, 3); rb_define_method(cConfig, "[]", ossl_config_get_section, 1); rb_define_method(cConfig, "section", ossl_config_get_section_old, 1); rb_define_method(cConfig, "[]=", ossl_config_set_section, 2); Index: ext/openssl/ossl_cipher.c =================================================================== --- ext/openssl/ossl_cipher.c (revision 23203) +++ ext/openssl/ossl_cipher.c (revision 23204) @@ -133,6 +133,7 @@ } #endif +#ifdef HAVE_OBJ_NAME_DO_ALL_SORTED /* * call-seq: * Cipher.ciphers -> array[string...] @@ -142,7 +143,6 @@ static VALUE ossl_s_ciphers(VALUE self) { -#ifdef HAVE_OBJ_NAME_DO_ALL_SORTED VALUE ary; ary = rb_ary_new(); @@ -151,10 +151,10 @@ (void*)ary); return ary; +} #else - rb_notimplement(); +#define ossl_s_ciphers rb_f_notimplement #endif -} /* * call-seq: @@ -453,6 +453,7 @@ return key_length; } +#if defined(HAVE_EVP_CIPHER_CTX_SET_PADDING) /* * call-seq: * cipher.padding = integer -> integer @@ -466,18 +467,17 @@ static VALUE ossl_cipher_set_padding(VALUE self, VALUE padding) { -#if defined(HAVE_EVP_CIPHER_CTX_SET_PADDING) EVP_CIPHER_CTX *ctx; int pad = NUM2INT(padding); GetCipher(self, ctx); if (EVP_CIPHER_CTX_set_padding(ctx, pad) != 1) ossl_raise(eCipherError, NULL); + return padding; +} #else - rb_notimplement(); +#define ossl_cipher_set_padding rb_f_notimplement #endif - return padding; -} #define CIPHER_0ARG_INT(func) \ static VALUE \ Index: ext/openssl/ossl_pkcs5.c =================================================================== --- ext/openssl/ossl_pkcs5.c (revision 23203) +++ ext/openssl/ossl_pkcs5.c (revision 23204) @@ -7,6 +7,7 @@ VALUE mPKCS5; VALUE ePKCS5; +#ifdef HAVE_PKCS5_PBKDF2_HMAC /* * call-seq: * PKCS5.pbkdf2_hmac(pass, salt, iter, keylen, digest) => string @@ -25,7 +26,6 @@ static VALUE ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen, VALUE digest) { -#ifdef HAVE_PKCS5_PBKDF2_HMAC VALUE str; const EVP_MD *md; int len = NUM2INT(keylen); @@ -40,12 +40,13 @@ ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC"); return str; +} #else - rb_notimplement(); +#define ossl_pkcs5_pbkdf2_hmac rb_f_notimplement #endif -} +#ifdef HAVE_PKCS5_PBKDF2_HMAC_SHA1 /* * call-seq: * PKCS5.pbkdf2_hmac_sha1(pass, salt, iter, keylen) => string @@ -63,7 +64,6 @@ static VALUE ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen) { -#ifdef HAVE_PKCS5_PBKDF2_HMAC_SHA1 VALUE str; int len = NUM2INT(keylen); @@ -78,10 +78,10 @@ ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC_SHA1"); return str; +} #else - rb_notimplement(); +#define ossl_pkcs5_pbkdf2_hmac_sha1 rb_f_notimplement #endif -} void Init_ossl_pkcs5() Index: ext/openssl/ossl_x509ext.c =================================================================== --- ext/openssl/ossl_x509ext.c (revision 23203) +++ ext/openssl/ossl_x509ext.c (revision 23204) @@ -163,10 +163,10 @@ return crl; } +#ifdef HAVE_X509V3_SET_NCONF static VALUE ossl_x509extfactory_set_config(VALUE self, VALUE config) { -#ifdef HAVE_X509V3_SET_NCONF X509V3_CTX *ctx; CONF *conf; @@ -176,10 +176,10 @@ X509V3_set_nconf(ctx, conf); return config; +} #else - rb_notimplement(); +#define rb_f_fork rb_f_notimplement #endif -} static VALUE ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self) Index: ext/socket/socket.c =================================================================== --- ext/socket/socket.c (revision 23203) +++ ext/socket/socket.c (revision 23204) @@ -75,6 +75,7 @@ } #endif +#if defined HAVE_SOCKETPAIR /* * call-seq: * Socket.pair(domain, type, protocol) => [socket1, socket2] @@ -99,7 +100,6 @@ VALUE rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass) { -#if defined HAVE_SOCKETPAIR VALUE domain, type, protocol; int d, t, p, sp[2]; int ret; @@ -127,10 +127,10 @@ return rb_ensure(pair_yield, r, io_close, s1); } return r; +} #else - rb_notimplement(); +#define rsock_sock_s_socketpair rb_f_notimplement #endif -} /* * call-seq: @@ -867,11 +867,7 @@ return rb_str_new2(un.nodename); } #else -static VALUE -sock_gethostname(VALUE obj) -{ - rb_notimplement(); -} +#define sock_gethostname rb_f_notimplement #endif #endif @@ -1470,6 +1466,7 @@ } #endif +#if defined(HAVE_GETIFADDRS) || (defined(SIOCGLIFCONF) && defined(SIOCGLIFNUM) && !defined(__hpux)) || defined(SIOCGIFCONF) || defined(_WIN32) /* * call-seq: * Socket.ip_address_list => array @@ -1748,10 +1745,11 @@ CloseHandle(h); return list; -#else - rb_notimplement(); #endif } +#else +#define socket_s_ip_address_list rb_f_notimplement +#endif /* * Class +Socket+ provides access to the underlying operating system Index: ext/socket/basicsocket.c =================================================================== --- ext/socket/basicsocket.c (revision 23203) +++ ext/socket/basicsocket.c (revision 23204) @@ -244,6 +244,7 @@ return INT2FIX(0); } +#if !defined(__BEOS__) /* * Document-method: getsockopt * call-seq: getsockopt(level, optname) @@ -287,7 +288,6 @@ static VALUE bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname) { -#if !defined(__BEOS__) int level, option; socklen_t len; char *buf; @@ -307,10 +307,10 @@ rb_sys_fail_path(fptr->pathv); return rsock_sockopt_new(family, level, option, rb_str_new(buf, len)); +} #else - rb_notimplement(); +#define bsock_getsockopt rb_f_notimplement #endif -} /* * call-seq: @@ -361,6 +361,7 @@ return rb_str_new((char*)&buf, len); } +#if defined(HAVE_GETPEEREID) || defined(SO_PEERCRED) || defined(HAVE_GETPEERUCRED) /* * call-seq: * basicsocket.getpeereid => [euid, egid] @@ -412,10 +413,11 @@ ret = rb_assoc_new(UIDT2NUM(ucred_geteuid(uc)), GIDT2NUM(ucred_getegid(uc))); ucred_free(uc); return ret; +#endif +} #else - rb_notimplement(); +#define bsock_getpeereid rb_f_notimplement #endif -} /* * call-seq: Index: ext/socket/ancdata.c =================================================================== --- ext/socket/ancdata.c (revision 23203) +++ ext/socket/ancdata.c (revision 23204) @@ -176,6 +176,7 @@ return v; } +#ifdef SCM_RIGHTS /* * call-seq: * Socket::AncillaryData.unix_rights(io1, io2, ...) => ancillarydata @@ -188,7 +189,6 @@ static VALUE ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass) { -#ifdef SCM_RIGHTS VALUE result, str, ary; int i; @@ -216,11 +216,12 @@ result = ancdata_new(AF_UNIX, SOL_SOCKET, SCM_RIGHTS, str); rb_ivar_set(result, rb_intern("unix_rights"), ary); return result; +} #else - rb_notimplement(); +#define ancillary_s_unix_rights rb_f_notimplement #endif -} +#ifdef SCM_RIGHTS /* * call-seq: * ancillarydata.unix_rights => array-of-IOs or nil @@ -253,7 +254,6 @@ static VALUE ancillary_unix_rights(VALUE self) { -#ifdef SCM_RIGHTS int level, type; level = ancillary_level(self); @@ -264,11 +264,12 @@ VALUE v = rb_attr_get(self, rb_intern("unix_rights")); return v; +} #else - rb_notimplement(); +#define ancillary_unix_rights rb_f_notimplement #endif -} +#if defined(SCM_TIMESTAMP) || defined(SCM_TIMESTAMPNS) || defined(SCM_BINTIME) /* * call-seq: * ancillarydata.timestamp => time @@ -300,7 +301,6 @@ static VALUE ancillary_timestamp(VALUE self) { -#if defined(SCM_TIMESTAMP) || defined(SCM_TIMESTAMPNS) || defined(SCM_BINTIME) int level, type; VALUE data; VALUE result = Qnil; @@ -342,10 +342,10 @@ rb_raise(rb_eTypeError, "timestamp ancillary data expected"); return result; +} #else - rb_notimplement(); +#define ancillary_timestamp rb_f_notimplement #endif -} /* * call-seq: @@ -391,6 +391,7 @@ return INT2NUM(i); } +#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */ /* * call-seq: * Socket::AncillaryData.ip_pktinfo(addr, ifindex) => ancdata @@ -414,7 +415,6 @@ static VALUE ancillary_s_ip_pktinfo(int argc, VALUE *argv, VALUE self) { -#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */ VALUE v_addr, v_ifindex, v_spec_dst; unsigned int ifindex; struct sockaddr_in sa; @@ -450,11 +450,12 @@ memcpy(&pktinfo.ipi_spec_dst, &sa.sin_addr, sizeof(pktinfo.ipi_spec_dst)); return ancdata_new(AF_INET, IPPROTO_IP, IP_PKTINFO, rb_str_new((char *)&pktinfo, sizeof(pktinfo))); +} #else - rb_notimplement(); +#define ancillary_s_ip_pktinfo rb_f_notimplement #endif -} +#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */ /* * call-seq: * ancdata.ip_pktinfo => [addr, ifindex, spec_dst] @@ -477,7 +478,6 @@ static VALUE ancillary_ip_pktinfo(VALUE self) { -#if defined(IPPROTO_IP) && defined(IP_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN_PKTINFO) && defined(HAVE_IPI_SPEC_DST) /* GNU/Linux */ int level, type; VALUE data; struct in_pktinfo pktinfo; @@ -505,11 +505,12 @@ v_spec_dst = rsock_addrinfo_new((struct sockaddr *)&sa, sizeof(sa), PF_INET, 0, 0, Qnil, Qnil); return rb_ary_new3(3, v_addr, UINT2NUM(pktinfo.ipi_ifindex), v_spec_dst); +} #else - rb_notimplement(); +#define ancillary_ip_pktinfo rb_f_notimplement #endif -} +#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ /* * call-seq: * Socket::AncillaryData.ipv6_pktinfo(addr, ifindex) => ancdata @@ -527,7 +528,6 @@ static VALUE ancillary_s_ipv6_pktinfo(VALUE self, VALUE v_addr, VALUE v_ifindex) { -#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ unsigned int ifindex; struct sockaddr_in6 sa; struct in6_pktinfo pktinfo; @@ -548,10 +548,10 @@ pktinfo.ipi6_ifindex = ifindex; return ancdata_new(AF_INET6, IPPROTO_IPV6, IPV6_PKTINFO, rb_str_new((char *)&pktinfo, sizeof(pktinfo))); +} #else - rb_notimplement(); +#define ancillary_s_ipv6_pktinfo rb_f_notimplement #endif -} #if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ static void @@ -580,6 +580,7 @@ } #endif +#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ /* * call-seq: * ancdata.ipv6_pktinfo => [addr, ifindex] @@ -597,7 +598,6 @@ static VALUE ancillary_ipv6_pktinfo(VALUE self) { -#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ struct in6_pktinfo pktinfo; struct sockaddr_in6 sa; VALUE v_addr; @@ -605,11 +605,12 @@ extract_ipv6_pktinfo(self, &pktinfo, &sa); v_addr = rsock_addrinfo_new((struct sockaddr *)&sa, sizeof(sa), PF_INET6, 0, 0, Qnil, Qnil); return rb_ary_new3(2, v_addr, UINT2NUM(pktinfo.ipi6_ifindex)); +} #else - rb_notimplement(); +#define ancillary_ipv6_pktinfo rb_f_notimplement #endif -} +#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ /* * call-seq: * ancdata.ipv6_pktinfo_addr => addr @@ -627,16 +628,16 @@ static VALUE ancillary_ipv6_pktinfo_addr(VALUE self) { -#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ struct in6_pktinfo pktinfo; struct sockaddr_in6 sa; extract_ipv6_pktinfo(self, &pktinfo, &sa); return rsock_addrinfo_new((struct sockaddr *)&sa, sizeof(sa), PF_INET6, 0, 0, Qnil, Qnil); +} #else - rb_notimplement(); +#define ancillary_ipv6_pktinfo_addr rb_f_notimplement #endif -} +#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ /* * call-seq: * ancdata.ipv6_pktinfo_ifindex => addr @@ -654,15 +655,14 @@ static VALUE ancillary_ipv6_pktinfo_ifindex(VALUE self) { -#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO) /* IPv6 RFC3542 */ struct in6_pktinfo pktinfo; struct sockaddr_in6 sa; extract_ipv6_pktinfo(self, &pktinfo, &sa); return UINT2NUM(pktinfo.ipi6_ifindex); +} #else - rb_notimplement(); +#define ancillary_ipv6_pktinfo_ifindex rb_f_notimplement #endif -} #if defined(SOL_SOCKET) && defined(SCM_RIGHTS) /* 4.4BSD */ static int @@ -1286,14 +1286,9 @@ return SSIZET2NUM(ss); } -#else -static VALUE -bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock) -{ - rb_notimplement(); -} #endif +#if defined(HAVE_SENDMSG) /* * call-seq: * basicsocket.sendmsg(mesg, flags=0, dest_sockaddr=nil, *controls) => numbytes_sent @@ -1331,7 +1326,11 @@ { return bsock_sendmsg_internal(argc, argv, sock, 0); } +#else +#define bsock_sendmsg rb_f_notimplement +#endif +#if defined(HAVE_SENDMSG) /* * call-seq: * basicsocket.sendmsg_nonblock(mesg, flags=0, dest_sockaddr=nil, *controls) => numbytes_sent @@ -1348,6 +1347,9 @@ { return bsock_sendmsg_internal(argc, argv, sock, 1); } +#else +#define bsock_sendmsg_nonblock rb_f_notimplement +#endif #if defined(HAVE_RECVMSG) struct recvmsg_args_struct { @@ -1675,14 +1677,9 @@ return ret; } -#else -static VALUE -bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock) -{ - rb_notimplement(); -} #endif +#if defined(HAVE_RECVMSG) /* * call-seq: * basicsocket.recvmsg(maxmesglen=nil, flags=0, maxcontrollen=nil, opts={}) => [mesg, sender_addrinfo, rflags, *controls] @@ -1741,7 +1738,11 @@ { return bsock_recvmsg_internal(argc, argv, sock, 0); } +#else +#define bsock_recvmsg rb_f_notimplement +#endif +#if defined(HAVE_RECVMSG) /* * call-seq: * basicsocket.recvmsg_nonblock(maxdatalen=nil, flags=0, maxcontrollen=nil, opts={}) => [data, sender_addrinfo, rflags, *controls] @@ -1758,6 +1759,9 @@ { return bsock_recvmsg_internal(argc, argv, sock, 1); } +#else +#define bsock_recvmsg_nonblock rb_f_notimplement +#endif void Init_ancdata(void) Index: ext/socket/unixsocket.c =================================================================== --- ext/socket/unixsocket.c (revision 23203) +++ ext/socket/unixsocket.c (revision 23204) @@ -171,6 +171,7 @@ return sendmsg(arg->fd, &arg->msg, 0); } +#if defined(HAVE_SENDMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS) /* * call-seq: * unixsocket.send_io(io) => nil @@ -190,7 +191,6 @@ static VALUE unix_send_io(VALUE sock, VALUE val) { -#if defined(HAVE_SENDMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS) int fd; rb_io_t *fptr; struct iomsg_arg arg; @@ -248,11 +248,10 @@ rb_sys_fail("sendmsg(2)"); return Qnil; +} #else - rb_notimplement(); - return Qnil; /* not reached */ +#define unix_send_io rb_f_notimplement #endif -} static VALUE recvmsg_blocking(void *data) @@ -261,6 +260,7 @@ return recvmsg(arg->fd, &arg->msg, 0); } +#if defined(HAVE_RECVMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS) /* * call-seq: * unixsocket.recv_io([klass [, mode]]) => io @@ -283,7 +283,6 @@ static VALUE unix_recv_io(int argc, VALUE *argv, VALUE sock) { -#if defined(HAVE_RECVMSG) && (FD_PASSING_BY_MSG_CONTROL || FD_PASSING_BY_MSG_ACCRIGHTS) VALUE klass, mode; rb_io_t *fptr; struct iomsg_arg arg; @@ -390,11 +389,10 @@ ff_argv[1] = mode; return rb_funcall2(klass, for_fd, ff_argc, ff_argv); } +} #else - rb_notimplement(); - return Qnil; /* not reached */ +#define unix_recv_io rb_f_notimplement #endif -} /* * call-seq: Index: ext/iconv/iconv.c =================================================================== --- ext/iconv/iconv.c (revision 23203) +++ ext/iconv/iconv.c (revision 23204) @@ -791,6 +791,7 @@ } #endif +#if defined(HAVE_ICONVLIST) || defined(HAVE___ICONV_FREE_LIST) static VALUE iconv_s_list(void) { @@ -821,11 +822,12 @@ for (i = 0; i < RARRAY_LEN(ary); i++) { rb_yield(RARRAY_PTR(ary)[i]); } -#else - rb_notimplement(); #endif return Qnil; } +#else +#define iconv_s_list rb_f_notimplement +#endif /* * Document-method: close @@ -944,6 +946,7 @@ return str; } +#ifdef ICONV_TRIVIALP /* * Document-method: trivial? * call-seq: trivial? @@ -953,16 +956,16 @@ static VALUE iconv_trivialp(VALUE self) { -#ifdef ICONV_TRIVIALP int trivial = 0; iconv_ctl(self, ICONV_TRIVIALP, trivial); if (trivial) return Qtrue; + return Qfalse; +} #else - rb_notimplement(); +#define iconv_trivialp rb_f_notimplement #endif - return Qfalse; -} +#ifdef ICONV_GET_TRANSLITERATE /* * Document-method: transliterate? * call-seq: transliterate? @@ -972,16 +975,16 @@ static VALUE iconv_get_transliterate(VALUE self) { -#ifdef ICONV_GET_TRANSLITERATE int trans = 0; iconv_ctl(self, ICONV_GET_TRANSLITERATE, trans); if (trans) return Qtrue; + return Qfalse; +} #else - rb_notimplement(); +#define iconv_get_transliterate rb_f_notimplement #endif - return Qfalse; -} +#ifdef ICONV_SET_TRANSLITERATE /* * Document-method: transliterate= * call-seq: cd.transliterate = flag @@ -991,15 +994,15 @@ static VALUE iconv_set_transliterate(VALUE self, VALUE transliterate) { -#ifdef ICONV_SET_TRANSLITERATE int trans = RTEST(transliterate); iconv_ctl(self, ICONV_SET_TRANSLITERATE, trans); + return self; +} #else - rb_notimplement(); +#define iconv_set_transliterate rb_f_notimplement #endif - return self; -} +#ifdef ICONV_GET_DISCARD_ILSEQ /* * Document-method: discard_ilseq? * call-seq: discard_ilseq? @@ -1009,16 +1012,16 @@ static VALUE iconv_get_discard_ilseq(VALUE self) { -#ifdef ICONV_GET_DISCARD_ILSEQ int dis = 0; iconv_ctl(self, ICONV_GET_DISCARD_ILSEQ, dis); if (dis) return Qtrue; + return Qfalse; +} #else - rb_notimplement(); +#define iconv_get_discard_ilseq rb_f_notimplement #endif - return Qfalse; -} +#ifdef ICONV_SET_DISCARD_ILSEQ /* * Document-method: discard_ilseq= * call-seq: cd.discard_ilseq = flag @@ -1028,14 +1031,13 @@ static VALUE iconv_set_discard_ilseq(VALUE self, VALUE discard_ilseq) { -#ifdef ICONV_SET_DISCARD_ILSEQ int dis = RTEST(discard_ilseq); iconv_ctl(self, ICONV_SET_DISCARD_ILSEQ, dis); + return self; +} #else - rb_notimplement(); +#define iconv_set_discard_ilseq rb_f_notimplement #endif - return self; -} /* * Document-method: ctlmethods -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/