diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-31 09:46:31 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-31 09:46:31 +0000 |
| commit | 1e0971fd107b40a5cf5c43158005a57addf66521 (patch) | |
| tree | e187839203692fb1f81d70129b0511576c26f92f /array.c | |
| parent | 70ce2b1cfb9445d33590f114c5522751e8a0a695 (diff) | |
| download | ruby-1e0971fd107b40a5cf5c43158005a57addf66521.tar.gz ruby-1e0971fd107b40a5cf5c43158005a57addf66521.tar.xz ruby-1e0971fd107b40a5cf5c43158005a57addf66521.zip | |
* 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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
| -rw-r--r-- | array.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -604,7 +604,10 @@ ary_make_partial0(VALUE ary, long offset, long len) assert(offset+len <= RARRAY_LEN(ary)); 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 { VALUE shared, result = ary_alloc(rb_obj_class(ary)); |
