mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #6577 from dearblue/ary_dup
Sharing arrays with `ary_dup()`
This commit is contained in:
+3
-1
@@ -1127,7 +1127,9 @@ mrb_ary_set(mrb_state *mrb, mrb_value ary, mrb_int n, mrb_value val)
|
||||
static struct RArray*
|
||||
ary_dup(mrb_state *mrb, struct RArray *a)
|
||||
{
|
||||
return ary_new_from_values(mrb, ARY_LEN(a), ARY_PTR(a));
|
||||
struct RArray *dup = ary_new_capa(mrb, 0);
|
||||
ary_replace(mrb, dup, a);
|
||||
return dup;
|
||||
}
|
||||
|
||||
MRB_API mrb_value
|
||||
|
||||
Reference in New Issue
Block a user