зеркало из https://github.com/github/ruby.git
* array.c (ary_partial0): recovers mistakenly feature change at r19723.
Array#[m,n] had returned an Array even for an instance of a subclass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d37df9fb13
Коммит
b4729e2db3
|
@ -1,3 +1,9 @@
|
||||||
|
Fri Oct 31 18:42:19 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||||
|
|
||||||
|
* array.c (ary_partial0): recovers mistakenly feature change at r19723.
|
||||||
|
Array#[m,n] had returned an Array even for an instance of a
|
||||||
|
subclass.
|
||||||
|
|
||||||
Fri Oct 31 18:05:05 2008 Martin Duerst <duerst@it.aoyama.ac.jp>
|
Fri Oct 31 18:05:05 2008 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||||
|
|
||||||
* enc/trans/single_byte.trans, maccroatioan-tbl.rb,
|
* enc/trans/single_byte.trans, maccroatioan-tbl.rb,
|
||||||
|
|
5
array.c
5
array.c
|
@ -610,7 +610,10 @@ ary_make_partial0(VALUE ary, long offset, long len)
|
||||||
assert(offset+len <= RARRAY_LEN(ary));
|
assert(offset+len <= RARRAY_LEN(ary));
|
||||||
|
|
||||||
if (len <= RARRAY_EMBED_LEN_MAX) {
|
if (len <= RARRAY_EMBED_LEN_MAX) {
|
||||||
return rb_ary_new4(len, RARRAY_PTR(ary) + offset);
|
VALUE result = ary_alloc(rb_obj_class(ary));
|
||||||
|
MEMCPY(ARY_EMBED_PTR(result), RARRAY_PTR(ary) + offset, VALUE, len);
|
||||||
|
ARY_SET_EMBED_LEN(result, len);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VALUE shared, result = ary_alloc(rb_obj_class(ary));
|
VALUE shared, result = ary_alloc(rb_obj_class(ary));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче