From cee9f4a4999c3421b40a48f67714609128a2987b Mon Sep 17 00:00:00 2001 From: normal Date: Thu, 4 Jun 2015 22:11:19 +0000 Subject: 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 --- io.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index e0bbbfa6c7..150c99c0db 100644 --- a/io.c +++ b/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")); } -- cgit v1.2.3