summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-08-29 10:40:40 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-08-29 18:34:09 +0900
commit0b81e7d6e2810adac081965f0da1d8064888c0bd (patch)
tree0ad28e52f3395e56d0a7c9c0a704c3195aa8c99c /vm.c
parent0766f67168cf248b698a8b2cde1c22c526374be7 (diff)
drop-in type check for rb_define_method_id
We can check the function pointer passed to rb_define_method_id like how we do so in rb_define_method. This method is relatively rarely used so there are less problems found than the other APIs.
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index 2ee9d84ae2..2097dde434 100644
--- a/vm.c
+++ b/vm.c
@@ -2902,6 +2902,24 @@ static VALUE usage_analysis_operand_clear(VALUE self);
static VALUE usage_analysis_register_clear(VALUE self);
#endif
+static VALUE
+f_raise(int c, VALUE *v, VALUE _)
+{
+ return rb_f_raise(c, v);
+}
+
+static VALUE
+f_proc(VALUE _)
+{
+ return rb_block_proc();
+}
+
+static VALUE
+f_lambda(VALUE _)
+{
+ return rb_block_lambda();
+}
+
void
Init_VM(void)
{
@@ -2940,9 +2958,9 @@ Init_VM(void)
rb_define_method_id(klass, id_core_set_postexe, m_core_set_postexe, 0);
rb_define_method_id(klass, id_core_hash_merge_ptr, m_core_hash_merge_ptr, -1);
rb_define_method_id(klass, id_core_hash_merge_kwd, m_core_hash_merge_kwd, 2);
- rb_define_method_id(klass, id_core_raise, rb_f_raise, -1);
- rb_define_method_id(klass, idProc, rb_block_proc, 0);
- rb_define_method_id(klass, idLambda, rb_block_lambda, 0);
+ rb_define_method_id(klass, id_core_raise, f_raise, -1);
+ rb_define_method_id(klass, idProc, f_proc, 0);
+ rb_define_method_id(klass, idLambda, f_lambda, 0);
rb_obj_freeze(fcore);
RBASIC_CLEAR_CLASS(klass);
rb_obj_freeze(klass);