summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-09 00:03:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-09 00:03:40 +0000
commit6c4ab3f43950d3f0302fea3ce890032a8dd34d44 (patch)
treea5c2a05748e5d7330e1368a2c6656e9a058da1b4
parent1b7143309b7570dd41a3d311f193f5d382d10996 (diff)
load.c: hide internal objects
* load.c (rb_construct_expanded_load_path, Init_load): hide internal objects, expanded_load_path, {load_path,loaded_features}_snapshot, and loaded_features_index in the VM, and ruby_dln_librefs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--load.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/load.c b/load.c
index df20181732..231f873bc8 100644
--- a/load.c
+++ b/load.c
@@ -58,7 +58,7 @@ rb_construct_expanded_load_path(int type, int *has_relative, int *has_non_cache)
long i;
int level = rb_safe_level();
- ary = rb_ary_new2(RARRAY_LEN(load_path));
+ ary = rb_ary_tmp_new(RARRAY_LEN(load_path));
for (i = 0; i < RARRAY_LEN(load_path); ++i) {
VALUE path, as_str, expanded_path;
int is_string, non_cache;
@@ -1112,15 +1112,16 @@ Init_load()
rb_alias_variable(rb_intern("$-I"), id_load_path);
rb_alias_variable(rb_intern("$LOAD_PATH"), id_load_path);
vm->load_path = rb_ary_new();
- vm->expanded_load_path = rb_ary_new();
- vm->load_path_snapshot = rb_ary_new();
+ vm->expanded_load_path = rb_ary_tmp_new(0);
+ vm->load_path_snapshot = rb_ary_tmp_new(0);
vm->load_path_check_cache = 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_new();
+ vm->loaded_features_snapshot = rb_ary_tmp_new(0);
vm->loaded_features_index = rb_hash_new();
+ RBASIC(vm->loaded_features_index)->klass = 0;
rb_define_global_function("load", rb_f_load, -1);
rb_define_global_function("require", rb_f_require, 1);
@@ -1130,6 +1131,6 @@ Init_load()
rb_define_global_function("autoload", rb_f_autoload, 2);
rb_define_global_function("autoload?", rb_f_autoload_p, 1);
- ruby_dln_librefs = rb_ary_new();
+ ruby_dln_librefs = rb_ary_tmp_new();
rb_gc_register_mark_object(ruby_dln_librefs);
}