diff options
author | Koichi Sasada <ko1@atdot.net> | 2019-05-23 11:19:23 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2019-05-23 11:26:33 +0900 |
commit | 0eff21af8d03a9d2b881b9cce963262da3d952dc (patch) | |
tree | 52a54e9c466c3804e77b6abe3a8aa2282f7ba97d /vm_args.c | |
parent | bb29ed6e336d26f25722f356e83a027394008443 (diff) |
update Array's length correctly.
ARRAY_ASET() does not change the length of array, so
use rb_ary_push() instead of ARRAY_ASET(). It prevents
updating reference on GC.compact.
Diffstat (limited to 'vm_args.c')
-rw-r--r-- | vm_args.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -902,8 +902,8 @@ vm_caller_setup_arg_block(const rb_execution_context_t *ec, rb_control_frame_t * if (NIL_P(func)) { /* TODO: limit cached funcs */ VALUE callback_arg = rb_ary_tmp_new(2); - RARRAY_ASET(callback_arg, 0, block_code); - RARRAY_ASET(callback_arg, 1, ref); + rb_ary_push(callback_arg, block_code); + rb_ary_push(callback_arg, ref); OBJ_FREEZE_RAW(callback_arg); func = rb_func_proc_new(refine_sym_proc_call, callback_arg); rb_hash_aset(ref, block_code, func); |