diff options
author | 卜部昌平 <[email protected]> | 2019-08-27 12:08:32 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2019-08-27 15:52:26 +0900 |
commit | 79d280a5e855d623957638b6d73f530995e03cae (patch) | |
tree | 4aed99e54fb6ebdbd3fb5e6f9e5032f721993589 /variable.c | |
parent | 50f5a0a8d6e7ad89d6caff695a08dbd38edb7a6e (diff) |
rb_ivar_foreach now free from ANYARGS
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is
dangerous and should be extinct. This commit adds a function
prototype for rb_ivar_foreach. Luckily this change revealed no
problematic usage of the function.
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/variable.c b/variable.c index bc79dd6cc3..4a922126c5 100644 --- a/variable.c +++ b/variable.c @@ -1391,9 +1391,11 @@ rb_ivar_defined(VALUE obj, ID id) return Qfalse; } +typedef int rb_ivar_foreach_callback_func(ID key, VALUE val, st_data_t arg); + struct obj_ivar_tag { VALUE obj; - int (*func)(ID key, VALUE val, st_data_t arg); + rb_ivar_foreach_callback_func *func; st_data_t arg; }; @@ -1411,7 +1413,7 @@ obj_ivar_i(st_data_t key, st_data_t index, st_data_t arg) } static void -obj_ivar_each(VALUE obj, int (*func)(ANYARGS), st_data_t arg) +obj_ivar_each(VALUE obj, rb_ivar_foreach_callback_func *func, st_data_t arg) { st_table *tbl; struct obj_ivar_tag data; @@ -1429,7 +1431,7 @@ obj_ivar_each(VALUE obj, int (*func)(ANYARGS), st_data_t arg) struct gen_ivar_tag { struct gen_ivtbl *ivtbl; - int (*func)(ID key, VALUE val, st_data_t arg); + rb_ivar_foreach_callback_func *func; st_data_t arg; }; @@ -1448,7 +1450,7 @@ gen_ivar_each_i(st_data_t key, st_data_t index, st_data_t data) } static void -gen_ivar_each(VALUE obj, int (*func)(ANYARGS), st_data_t arg) +gen_ivar_each(VALUE obj, rb_ivar_foreach_callback_func *func, st_data_t arg) { struct gen_ivar_tag data; st_table *iv_index_tbl = RCLASS_IV_INDEX_TBL(rb_obj_class(obj)); @@ -1531,7 +1533,7 @@ rb_copy_generic_ivar(VALUE clone, VALUE obj) } void -rb_ivar_foreach(VALUE obj, int (*func)(ANYARGS), st_data_t arg) +rb_ivar_foreach(VALUE obj, rb_ivar_foreach_callback_func *func, st_data_t arg) { if (SPECIAL_CONST_P(obj)) return; switch (BUILTIN_TYPE(obj)) { |