summaryrefslogtreecommitdiffhomepage
path: root/src/array.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-07-12 14:44:36 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-07-12 14:44:36 +0900
commit059d707e3a2f5e3e528ec7249090b17a3c7de4d9 (patch)
tree41f855e2431e6a91e175e7bed649dac236ca8919 /src/array.c
parente1de86134d4f4b367e5a68ea091078cbeccb2815 (diff)
downloadmruby-059d707e3a2f5e3e528ec7249090b17a3c7de4d9.tar.gz
mruby-059d707e3a2f5e3e528ec7249090b17a3c7de4d9.zip
Add `ary_modify_check()` to `Array#unshift`; ref #3737
Diffstat (limited to 'src/array.c')
-rw-r--r--src/array.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/array.c b/src/array.c
index f3d29faec..2e8cf1116 100644
--- a/src/array.c
+++ b/src/array.c
@@ -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 {