mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Add ary_modify_check() to Array#unshift; ref #3737
This commit is contained in:
@@ -533,6 +533,7 @@ mrb_ary_unshift_m(mrb_state *mrb, mrb_value self)
|
||||
if (ARY_SHARED_P(a)
|
||||
&& a->aux.shared->refcnt == 1 /* shared only referenced from this array */
|
||||
&& a->ptr - a->aux.shared->ptr >= len) /* there's room for unshifted item */ {
|
||||
ary_modify_check(mrb, a);
|
||||
a->ptr -= len;
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user