From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS47066 71.19.144.0/20 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: normalperson@yhbt.net Received: from zedshaw2.xen.prgmr.com (zedshaw2.xen.prgmr.com [71.19.156.177]) by dcvr.yhbt.net (Postfix) with ESMTP id 0883C44C19D for ; Sat, 19 Oct 2013 07:19:29 +0000 (UTC) Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id 7AC7975019 for ; Sat, 19 Oct 2013 07:20:35 +0000 (UTC) MIME-Version: 1.0 Date: Sat, 19 Oct 2013 07:19:08 +0000 From: Eric Wong In-Reply-To: <20131019071908.GA25713@dcvr.yhbt.net> List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Message-Id: <20131019071908.GA25713@dcvr.yhbt.net> Precedence: list References: <20131019071908.GA25713@dcvr.yhbt.net> Sender: sleepy.penguin@librelist.org Subject: [sleepy.penguin] [PATCH] util: minor cleanup to favor rb_io_get_io To: sleepy.penguin@librelist.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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