* [sleepy.penguin] [PATCH] util: minor cleanup to favor rb_io_get_io
@ 2013-10-19 7:19 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2013-10-19 7:19 UTC (permalink / raw)
To: sleepy.penguin
This makes our code slightly smaller on Ruby 1.9+
---
ext/sleepy_penguin/extconf.rb | 1 +
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_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);
}
--
1.8.3.2.701.g8c4e4ec
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-10-19 7:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-19 7:19 [sleepy.penguin] [PATCH] util: minor cleanup to favor rb_io_get_io Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/sleepy_penguin.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).