ruby-changes:37874
From: normal <ko1@a...>
Date: Fri, 13 Mar 2015 07:07:32 +0900 (JST)
Subject: [ruby-changes:37874] normal:r49954 (trunk): ext/openssl/ossl_ssl.c: predefine wait_*able symbols
normal 2015-03-13 07:03:53 +0900 (Fri, 13 Mar 2015) New Revision: 49954 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49954 Log: ext/openssl/ossl_ssl.c: predefine wait_*able symbols This leads to a size reduction in openssl.so and reduces the chance of bugs due to typos. text data bss dec hex before: 333022 13164 3312 349498 5553a after: 332790 13164 3232 349186 55402 Modified files: trunk/ChangeLog trunk/ext/openssl/ossl_ssl.c Index: ChangeLog =================================================================== --- ChangeLog (revision 49953) +++ ChangeLog (revision 49954) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Mar 13 07:01:38 2015 Eric Wong <e@8...> + + * ext/openssl/ossl_ssl.c: predefine wait_*able symbols + Thu Mar 12 22:59:53 2015 Tanaka Akira <akr@f...> * test/lib/leakchecker.rb: Check environment variables. Index: ext/openssl/ossl_ssl.c =================================================================== --- ext/openssl/ossl_ssl.c (revision 49953) +++ ext/openssl/ossl_ssl.c (revision 49954) @@ -107,7 +107,7 @@ static const char *ossl_ssl_attrs[] = { https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L107 ID ID_callback_state; -static VALUE sym_exception; +static VALUE sym_exception, sym_wait_readable, sym_wait_writable; /* * SSLContext class @@ -1296,12 +1296,12 @@ ossl_start_ssl(VALUE self, int (*func)() https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1296 switch((ret2 = ssl_get_error(ssl, ret))){ case SSL_ERROR_WANT_WRITE: - if (no_exception) { return ID2SYM(rb_intern("wait_writable")); } + if (no_exception) { return sym_wait_writable; } write_would_block(nonblock); rb_io_wait_writable(FPTR_TO_FD(fptr)); continue; case SSL_ERROR_WANT_READ: - if (no_exception) { return ID2SYM(rb_intern("wait_readable")); } + if (no_exception) { return sym_wait_readable; } read_would_block(nonblock); rb_io_wait_readable(FPTR_TO_FD(fptr)); continue; @@ -1444,12 +1444,12 @@ ossl_ssl_read_internal(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1444 if (no_exception) { return Qnil; } rb_eof_error(); case SSL_ERROR_WANT_WRITE: - if (no_exception) { return ID2SYM(rb_intern("wait_writable")); } + if (no_exception) { return sym_wait_writable; } write_would_block(nonblock); rb_io_wait_writable(FPTR_TO_FD(fptr)); continue; case SSL_ERROR_WANT_READ: - if (no_exception) { return ID2SYM(rb_intern("wait_readable")); } + if (no_exception) { return sym_wait_readable; } read_would_block(nonblock); rb_io_wait_readable(FPTR_TO_FD(fptr)); continue; @@ -1532,12 +1532,12 @@ ossl_ssl_write_internal(VALUE self, VALU https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1532 case SSL_ERROR_NONE: goto end; case SSL_ERROR_WANT_WRITE: - if (no_exception) { return ID2SYM(rb_intern("wait_writable")); } + if (no_exception) { return sym_wait_writable; } write_would_block(nonblock); rb_io_wait_writable(FPTR_TO_FD(fptr)); continue; case SSL_ERROR_WANT_READ: - if (no_exception) { return ID2SYM(rb_intern("wait_readable")); } + if (no_exception) { return sym_wait_readable; } read_would_block(nonblock); rb_io_wait_readable(FPTR_TO_FD(fptr)); continue; @@ -2313,5 +2313,8 @@ Init_ossl_ssl(void) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L2313 ossl_ssl_def_const(OP_NETSCAPE_CA_DN_BUG); ossl_ssl_def_const(OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG); +#undef rb_intern sym_exception = ID2SYM(rb_intern("exception")); + sym_wait_readable = ID2SYM(rb_intern("wait_readable")); + sym_wait_writable = ID2SYM(rb_intern("wait_writable")); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/