diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-11 03:44:52 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-11 03:44:52 +0000 |
commit | 153fa2565858eeac7a757c655b2e55ae01106859 (patch) | |
tree | ce768032b04cd7fbf1d0da93de19ec3ac3e40870 /array.c | |
parent | 48d5eb3d406a46beb53069f1060ae385a23a897b (diff) | |
download | ruby-153fa2565858eeac7a757c655b2e55ae01106859.tar.gz |
array.c: maybe shared array
* array.c (ary_reject): may be turned into a shared array during
the given block. [ruby-dev:48101] [Bug #9727]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r-- | array.c | 15 |
1 files changed, 1 insertions, 14 deletions
@@ -905,19 +905,6 @@ rb_ary_push(VALUE ary, VALUE item) return ary; } -static VALUE -rb_ary_push_1(VALUE ary, VALUE item) -{ - long idx = RARRAY_LEN(ary); - - if (idx >= ARY_CAPA(ary)) { - ary_double_capa(ary, idx); - } - RARRAY_ASET(ary, idx, item); - ARY_SET_LEN(ary, idx + 1); - return ary; -} - VALUE rb_ary_cat(VALUE ary, const VALUE *ptr, long len) { @@ -3084,7 +3071,7 @@ ary_reject(VALUE orig, VALUE result) for (i = 0; i < RARRAY_LEN(orig); i++) { VALUE v = RARRAY_AREF(orig, i); if (!RTEST(rb_yield(v))) { - rb_ary_push_1(result, v); + rb_ary_push(result, v); } } return result; |