From mboxrd@z Thu Jan 1 00:00:00 1970 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=-0.9 required=3.0 tests=AWL,BAYES_00,FREEMAIL_FROM, MSGID_FROM_MTA_HEADER shortcircuit=no autolearn=ham version=3.3.2 Path: news.gmane.org!not-for-mail From: Aeon Newsgroups: gmane.comp.lang.ruby.kgio.general Subject: Re: [PATCH 1/3] tryopen: remove RARRAY_PTR usage in init Date: Wed, 25 Sep 2013 16:37:20 -0500 Message-ID: References: <1380138185-5435-1-git-send-email-normalperson@yhbt.net> <1380138185-5435-1-git-send-email-normalperson@yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: ger.gmane.org 1380145077 26388 80.91.229.3 (25 Sep 2013 21:37:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Sep 2013 21:37:57 +0000 (UTC) To: kgio@librelist.org Original-X-From: kgio@librelist.org Wed Sep 25 23:38:01 2013 Return-path: Envelope-to: gclrkg-kgio@m.gmane.org List-Archive: List-Help: List-Id: List-Post: List-Subscribe: List-Unsubscribe: Precedence: list Original-Sender: kgio@librelist.org Xref: news.gmane.org gmane.comp.lang.ruby.kgio.general:239 Archived-At: Received: from zedshaw2.xen.prgmr.com ([71.19.156.177]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VOwmW-0005Kv-Qg for gclrkg-kgio@m.gmane.org; Wed, 25 Sep 2013 23:38:01 +0200 Received: from zedshaw2.xen.prgmr.com (unknown [IPv6:::1]) by zedshaw2.xen.prgmr.com (Postfix) with ESMTP id 3EAFE7511E for ; Wed, 25 Sep 2013 21:48:37 +0000 (UTC) Content-Transfer-Encoding: 7bit X-Content-Filtered-By: PublicInbox::Filter 0.0.1 How can I unsubscribe from this list? I am not even sure where I got signed up. -Aaron On Wed, Sep 25, 2013 at 2:43 PM, Eric Wong wrote: > From: Eric Wong > > This is trivially non-performance-critical, and can only > help with advanced GCs in Ruby 2.1.0 and Rubinius > --- > ext/kgio/tryopen.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/ext/kgio/tryopen.c b/ext/kgio/tryopen.c > index 5fa6ada..902c745 100644 > --- a/ext/kgio/tryopen.c > +++ b/ext/kgio/tryopen.c > @@ -135,8 +135,7 @@ void init_kgio_tryopen(void) > VALUE mPipeMethods = rb_const_get(mKgio, rb_intern("PipeMethods")); > VALUE cFile; > VALUE tmp; > - VALUE *ptr; > - long len; > + long i, len; > > id_path = rb_intern("path"); > id_for_fd = rb_intern("for_fd"); > @@ -161,15 +160,15 @@ void init_kgio_tryopen(void) > > errno2sym = st_init_numtable(); > tmp = rb_funcall(rb_mErrno, rb_intern("constants"), 0); > - ptr = RARRAY_PTR(tmp); > len = RARRAY_LEN(tmp); > - for (; --len >= 0; ptr++) { > + for (i = 0; i < len; i++) { > VALUE error; > + VALUE err = rb_ary_entry(tmp, i); > ID const_id; > > - switch (TYPE(*ptr)) { > - case T_SYMBOL: const_id = SYM2ID(*ptr); break; > - case T_STRING: const_id = rb_intern(RSTRING_PTR(*ptr)); > break; > + switch (TYPE(err)) { > + case T_SYMBOL: const_id = SYM2ID(err); break; > + case T_STRING: const_id = rb_intern(RSTRING_PTR(err)); > break; > default: rb_bug("constant not a symbol or string"); > } > > -- > 1.8.3.2.701.g8c4e4ec > >