1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm_core.h: assertions for Proc

* vm_core.h (vm_proc_block): assert before accessing.

* vm_core.h (vm_proc_iseq): remove duplicate assertion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-03-14 04:03:48 +00:00
parent 9fa56026e5
commit a7d6470f35

View file

@ -1309,9 +1309,8 @@ vm_block_type_set(const struct rb_block *block, enum rb_block_type type)
static inline const struct rb_block *
vm_proc_block(VALUE procval)
{
rb_proc_t *proc = RTYPEDDATA_DATA(procval);
VM_ASSERT(rb_obj_is_proc(procval));
return &proc->block;
return &((rb_proc_t *)RTYPEDDATA_DATA(procval))->block;
}
static inline const rb_iseq_t *vm_block_iseq(const struct rb_block *block);
@ -1320,7 +1319,6 @@ static inline const VALUE *vm_block_ep(const struct rb_block *block);
static inline const rb_iseq_t *
vm_proc_iseq(VALUE procval)
{
VM_ASSERT(rb_obj_is_proc(procval));
return vm_block_iseq(vm_proc_block(procval));
}