mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6014e76a40
commit
ddf2558a16
2 changed files with 14 additions and 7 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Mar 13 07:01:38 2015 Eric Wong <e@80x24.org>
|
||||
|
||||
* ext/openssl/ossl_ssl.c: predefine wait_*able symbols
|
||||
|
||||
Thu Mar 12 22:59:53 2015 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/lib/leakchecker.rb: Check environment variables.
|
||||
|
|
|
@ -107,7 +107,7 @@ static const char *ossl_ssl_attrs[] = {
|
|||
|
||||
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)(), const char *funcname,
|
|||
|
||||
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 *argv, VALUE self, int nonblock)
|
|||
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, VALUE str, int nonblock, int no_exception)
|
|||
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)
|
|||
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"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue