summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-08-27 11:16:52 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-08-27 15:52:26 +0900
commitae2dc3f217ba9f181471f39a7e5ce72a28b27c2a (patch)
treee506115b9dd5c2adb07946763506a5b46d36b5f0 /load.c
parent78628618da98236fc1bf702079185b36ed394e2a (diff)
rb_define_hooked_variable now free from ANYARGS
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit uses rb_gvar_getter_t / rb_gvar_setter_t for rb_define_hooked_variable / rb_define_virtual_variable which revealed lots of function prototype inconsistencies. Some of them were literally decades old, going back to dda5dc00cff334cac373096d444a0fd59e716124.
Diffstat (limited to 'load.c')
-rw-r--r--load.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/load.c b/load.c
index 6ebe8e5982..bc7abf1521 100644
--- a/load.c
+++ b/load.c
@@ -143,8 +143,9 @@ rb_get_expanded_load_path(void)
}
static VALUE
-load_path_getter(ID id, rb_vm_t *vm)
+load_path_getter(ID id, VALUE * p)
{
+ rb_vm_t *vm = (void *)p;
return vm->load_path;
}
@@ -154,6 +155,12 @@ get_loaded_features(void)
return GET_VM()->loaded_features;
}
+static VALUE
+get_$LOADED_FEATURES(ID _x, VALUE *_y)
+{
+ return get_loaded_features();
+}
+
static void
reset_loaded_features_snapshot(void)
{
@@ -1258,8 +1265,8 @@ Init_load(void)
vm->load_path_check_cache = 0;
rb_define_singleton_method(vm->load_path, "resolve_feature_path", rb_resolve_feature_path, 1);
- rb_define_virtual_variable("$\"", get_loaded_features, 0);
- rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0);
+ rb_define_virtual_variable("$\"", get_$LOADED_FEATURES, 0);
+ rb_define_virtual_variable("$LOADED_FEATURES", get_$LOADED_FEATURES, 0);
vm->loaded_features = rb_ary_new();
vm->loaded_features_snapshot = rb_ary_tmp_new(0);
vm->loaded_features_index = st_init_numtable();