diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-10-19 07:16:22 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-10-19 07:16:22 +0000 |
commit | 782dba32b5534ffaa5727a762a4c628bdac32331 (patch) | |
tree | 5540b534d17dabb19d8f2186d23cdb39b4aff44b | |
parent | 23447e63e64753223768d8481eb3c98f1c933bdf (diff) | |
download | sleepy_penguin-782dba32b5534ffaa5727a762a4c628bdac32331.tar.gz |
This makes our code slightly smaller on Ruby 1.9+
-rw-r--r-- | ext/sleepy_penguin/extconf.rb | 1 | ||||
-rw-r--r-- | ext/sleepy_penguin/util.c | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/ext/sleepy_penguin/extconf.rb b/ext/sleepy_penguin/extconf.rb index 0e6977a..3a6152b 100644 --- a/ext/sleepy_penguin/extconf.rb +++ b/ext/sleepy_penguin/extconf.rb @@ -25,4 +25,5 @@ have_func('rb_thread_io_blocking_region') have_func('rb_thread_fd_close') have_func('rb_update_max_fd') have_func('rb_fd_fix_cloexec') +have_func('rb_io_get_io') create_makefile('sleepy_penguin_ext') diff --git a/ext/sleepy_penguin/util.c b/ext/sleepy_penguin/util.c index 717a099..9d2123f 100644 --- a/ext/sleepy_penguin/util.c +++ b/ext/sleepy_penguin/util.c @@ -100,7 +100,7 @@ int rb_sp_io_closed(VALUE io) case T_FILE: break; default: - io = rb_convert_type(io, T_FILE, "IO", "to_io"); + io = rb_io_get_io(io); } return my_rb_io_closed(io); @@ -110,7 +110,7 @@ int rb_sp_fileno(VALUE io) { rb_io_t *fptr; - io = rb_convert_type(io, T_FILE, "IO", "to_io"); + io = rb_io_get_io(io); GetOpenFile(io, fptr); return FPTR_TO_FD(fptr); } |