diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-08-28 18:19:11 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-08-29 18:34:09 +0900 |
commit | 7bcfd9189a6a0b2ad58fed988faaf795a4987893 (patch) | |
tree | 219f0c172e038ea6be1e103db11f7457dc703328 /object.c | |
parent | 7b6fde4258e700c0e0292bb091aa84a5e473342e (diff) |
drop-in type check for rb_define_global_function
We can check the function pointer passed to rb_define_global_function
like we do so in rb_define_method. It turns out that almost anybody
is misunderstanding the API.
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -4048,6 +4048,12 @@ rb_obj_dig(int argc, VALUE *argv, VALUE obj, VALUE notfound) return obj; } +static VALUE +f_sprintf(int c, const VALUE *v, VALUE _) +{ + return rb_f_sprintf(c, v); +} + /* * Document-class: Class * @@ -4299,8 +4305,8 @@ InitVM_Object(void) rb_define_method(rb_mKernel, "is_a?", rb_obj_is_kind_of, 1); rb_define_method(rb_mKernel, "tap", rb_obj_tap, 0); - rb_define_global_function("sprintf", rb_f_sprintf, -1); /* in sprintf.c */ - rb_define_global_function("format", rb_f_sprintf, -1); /* in sprintf.c */ + rb_define_global_function("sprintf", f_sprintf, -1); + rb_define_global_function("format", f_sprintf, -1); rb_define_global_function("Integer", rb_f_integer, -1); rb_define_global_function("Float", rb_f_float, -1); |