From 6c6a25feca8752205d81c5247f85d8ae8fb880d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Wed, 25 Sep 2019 17:00:25 +0900 Subject: refactor add rb_method_entry_from_template Tired of rb_method_entry_create(..., rb_method_definition_create( ..., &(rb_method_foo_t) {...})) maneuver. Provide a function that does the thing to reduce copy&paste. --- method.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'method.h') diff --git a/method.h b/method.h index b46336b51e..105e4b6a40 100644 --- a/method.h +++ b/method.h @@ -185,15 +185,14 @@ STATIC_ASSERT(sizeof_method_def, offsetof(rb_method_definition_t, body)==8); ((def)->type == VM_METHOD_TYPE_REFINED && \ UNDEFINED_METHOD_ENTRY_P((def)->body.refined.orig_me)) -const rb_method_definition_t *rb_method_definition_create(rb_method_type_t which, ID what, const void *how); - void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_visibility_t visi); void rb_add_method_iseq(VALUE klass, ID mid, const rb_iseq_t *iseq, rb_cref_t *cref, rb_method_visibility_t visi); void rb_add_refined_method_entry(VALUE refined_class, ID mid); void rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_visibility_t visi); rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_visibility_t noex); -rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, const rb_method_definition_t *def); +const rb_method_entry_t *rb_method_entry_from_template(const rb_method_entry_t *template, const void *opts); +const rb_method_entry_t *rb_method_entry_for_missing(ID mid, VALUE klass); const rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id); -- cgit v1.2.3