mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
io.c: reduce size of :wait_*able code paths
* io.c (sym_wait_readable, sym_wait_writable): declare (io_getpartial): use sym_wait_readable (io_write_nonblock): use sym_wait_writable (Init_IO): initialize sym_wait_*able On 32-bit x86: text data bss dec hex filename 121003 56 252 121311 1d9df io.o 121035 56 252 121343 1d9ff io.o.orig git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c461d1eee
commit
cee9f4a499
2 changed files with 12 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Fri Jun 5 07:05:58 2015 Eric Wong <e@80x24.org>
|
||||
|
||||
* io.c (sym_wait_readable, sym_wait_writable): declare
|
||||
(io_getpartial): use sym_wait_readable
|
||||
(io_write_nonblock): use sym_wait_writable
|
||||
(Init_IO): initialize sym_wait_*able
|
||||
|
||||
Fri Jun 5 06:43:00 2015 Eric Wong <e@80x24.org>
|
||||
|
||||
* doc/extension.rdoc: note rb_get_kwargs changes keywords_hash
|
||||
|
|
7
io.c
7
io.c
|
@ -176,6 +176,7 @@ static ID id_write, id_read, id_getc, id_flush, id_readpartial, id_set_encoding;
|
|||
static VALUE sym_mode, sym_perm, sym_extenc, sym_intenc, sym_encoding, sym_open_args;
|
||||
static VALUE sym_textmode, sym_binmode, sym_autoclose;
|
||||
static VALUE sym_SET, sym_CUR, sym_END;
|
||||
static VALUE sym_wait_readable, sym_wait_writable;
|
||||
#ifdef SEEK_DATA
|
||||
static VALUE sym_DATA;
|
||||
#endif
|
||||
|
@ -2523,7 +2524,7 @@ io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock, int no_exception)
|
|||
goto again;
|
||||
if (nonblock && (errno == EWOULDBLOCK || errno == EAGAIN)) {
|
||||
if (no_exception)
|
||||
return ID2SYM(rb_intern("wait_readable"));
|
||||
return sym_wait_readable;
|
||||
else
|
||||
rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "read would block");
|
||||
}
|
||||
|
@ -2717,7 +2718,7 @@ io_write_nonblock(VALUE io, VALUE str, int no_exception)
|
|||
if (n == -1) {
|
||||
if (errno == EWOULDBLOCK || errno == EAGAIN) {
|
||||
if (no_exception) {
|
||||
return ID2SYM(rb_intern("wait_writable"));
|
||||
return sym_wait_writable;
|
||||
}
|
||||
else {
|
||||
rb_readwrite_sys_fail(RB_IO_WAIT_WRITABLE, "write would block");
|
||||
|
@ -12445,4 +12446,6 @@ Init_IO(void)
|
|||
#ifdef SEEK_HOLE
|
||||
sym_HOLE = ID2SYM(rb_intern("HOLE"));
|
||||
#endif
|
||||
sym_wait_readable = ID2SYM(rb_intern("wait_readable"));
|
||||
sym_wait_writable = ID2SYM(rb_intern("wait_writable"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue