From: Eric Wong <normalperson@yhbt.net>
To: sleepy.penguin@librelist.org
Subject: [sleepy.penguin] [PATCH] util: minor cleanup to favor rb_io_get_io
Date: Sat, 19 Oct 2013 07:19:08 +0000 [thread overview]
Message-ID: <20131019071908.GA25713@dcvr.yhbt.net> (raw)
In-Reply-To: <20131019071908.GA25713@dcvr.yhbt.net>
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
parent reply other threads:[~2013-10-19 7:19 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20131019071908.GA25713@dcvr.yhbt.net>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/sleepy_penguin/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131019071908.GA25713@dcvr.yhbt.net \
--to=normalperson@yhbt.net \
--cc=sleepy.penguin@librelist.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).