зеркало из https://github.com/github/ruby.git
* 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:
Родитель
dd54da6ede
Коммит
8e75f9705f
|
@ -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
|
||||
|
|
9
array.c
9
array.c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче