Skip to content

Commit

Permalink
Refactoring: Use array_copy instead of for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ksss committed Jan 23, 2017
1 parent 4d38cad commit 78a395d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 78a395d

Please sign in to comment.