From: Aeon <aaron.bryson@gmail.com>
To: kgio@librelist.org
Subject: Re: [PATCH 1/3] tryopen: remove RARRAY_PTR usage in init
Date: Wed, 25 Sep 2013 16:37:20 -0500 [thread overview]
Message-ID: <CALxUBYfZR-QC1ZDnJyy=e2+D0tSZ3UffkskFg7MEDUXR2xZvMA@mail.gmail.com> (raw)
In-Reply-To: 1380138185-5435-1-git-send-email-normalperson@yhbt.net
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 <normalperson@yhbt.net> wrote:
> From: Eric Wong <e@yhbt.net>
>
> 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
>
>
next prev parent reply other threads:[~2013-09-25 21:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 19:43 [PATCH 1/3] tryopen: remove RARRAY_PTR usage in init Eric Wong
2013-09-25 19:43 ` [PATCH 2/3] read_write: remove the rest of RARRAY_PTR usage Eric Wong
2013-09-25 19:43 ` [PATCH 3/3] my_writev: stylistic fixes Eric Wong
2013-09-25 19:44 ` [PATCH 1/3] tryopen: remove RARRAY_PTR usage in init Eric Wong
2013-09-25 21:37 ` Aeon [this message]
2013-09-25 22:00 ` Eric Wong
2013-09-26 3:02 ` Aeon
-- strict thread matches above, loose matches on Subject: below --
2013-09-25 19:42 Eric Wong
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/kgio/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALxUBYfZR-QC1ZDnJyy=e2+D0tSZ3UffkskFg7MEDUXR2xZvMA@mail.gmail.com' \
--to=aaron.bryson@gmail.com \
--cc=kgio@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/kgio.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).