summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
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 b4216ac1d0..a7c74a2aa4 100644
--- a/array.c
+++ b/array.c
@@ -1778,8 +1778,7 @@ rb_ary_empty_p(VALUE ary)
VALUE
rb_ary_dup(VALUE ary)
{
- VALUE ary_class = rb_obj_class(ary);
- VALUE dup = ary_new(ary_class ? ary_class : rb_cArray, RARRAY_LEN(ary));
+ VALUE dup = rb_ary_new2(RARRAY_LEN(ary));
MEMCPY(RARRAY_PTR(dup), RARRAY_PTR(ary), VALUE, RARRAY_LEN(ary));
ARY_SET_LEN(dup, RARRAY_LEN(ary));
return dup;