1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* array.c (rb_ary_push): bypass rb_ary_store().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2009-04-20 22:09:30 +00:00
parent dd54da6ede
commit 8e75f9705f
2 changed files with 12 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Tue Apr 21 07:07:45 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_push): bypass rb_ary_store().
Tue Apr 21 01:25:16 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* bignum.c (bigsub_int): subtraction without making internal

View file

@ -697,7 +697,14 @@ ary_take_first_or_last(int argc, VALUE *argv, VALUE ary, enum ary_take_pos_flags
VALUE
rb_ary_push(VALUE ary, VALUE item)
{
rb_ary_store(ary, RARRAY_LEN(ary), item);
long idx = RARRAY_LEN(ary);
rb_ary_modify(ary);
if (idx >= ARY_CAPA(ary)) {
ary_double_capa(ary, idx);
}
RARRAY_PTR(ary)[idx] = item;
ARY_SET_LEN(ary, idx + 1);
return ary;
}