summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-04 22:11:19 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-04 22:11:19 +0000
commitcee9f4a4999c3421b40a48f67714609128a2987b (patch)
treec68aba97b46560c4c9dd2f39d8e9234fc6c1075d
parent5c461d1eee028a3e833adb85263d608a0809b429 (diff)
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
-rw-r--r--ChangeLog7
-rw-r--r--io.c7
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c62aae7..22143c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/io.c b/io.c
index e0bbbfa..150c99c 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"));
}