summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-07 01:37:34 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-07 01:37:34 +0000
commitcf0838f414045a9a5c6f1d43310d332919418f89 (patch)
tree1b97c2708f7588a8c84e8beddf8af7334fecfde3 /array.c
parentcf5ef3db5e33195ef8cbf5288456f60c6d90f75c (diff)
* array.c (rb_ary_sample): use rb_ary_dup().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/array.c b/array.c
index f1919fd..6b2c6b2 100644
--- a/array.c
+++ b/array.c
@@ -4596,8 +4596,7 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary)
});
}
else {
- result = rb_ary_subseq(ary, 0, len);
- rb_ary_modify(result);
+ result = rb_ary_dup(ary);
RBASIC_CLEAR_CLASS(result);
RB_GC_GUARD(ary);
RARRAY_PTR_USE(result, ptr_result, {