Commit 40ec03c8 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #3412 from ksss/mrb_ary_splice

Refactoring: Use array_copy instead of for loop
parents 4d38cad3 78a395d4
......@@ -590,7 +590,7 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
{
struct RArray *a = mrb_ary_ptr(ary);
const mrb_value *argv;
mrb_int i, argc;
mrb_int argc;
ary_modify(mrb, a);
......@@ -631,9 +631,7 @@ mrb_ary_splice(mrb_state *mrb, mrb_value ary, mrb_int head, mrb_int len, mrb_val
}
ary_fill_with_nil(a->ptr + a->len, head - a->len);
if (argc > 0) {
for (i = 0; i < argc; i++) {
a->ptr[head + i] = argv[i];
}
array_copy(a->ptr + head, argv, argc);
}
a->len = len;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment