summaryrefslogtreecommitdiff
path: root/eval_load.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-14 02:19:02 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-14 02:19:02 +0000
commit9895ce9f7706f1c941bee73ada4cb6ef2bd204b7 (patch)
tree891d52876b0b10af519bd95a36f04c159645cea1 /eval_load.c
parent9ba43ab6d48968eaced9b0452e6f6bd45ddee7fa (diff)
* eval_load.c, yarvcore.h: use rb_vm_t#loaded_features instead of
rb_features (global variable). * yarvcore.c: mark rb_vm_t#loaded_features. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_load.c')
-rw-r--r--eval_load.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/eval_load.c b/eval_load.c
index d5a23ade2f..2048ea36b5 100644
--- a/eval_load.c
+++ b/eval_load.c
@@ -7,11 +7,8 @@
extern VALUE ruby_top_self;
VALUE ruby_dln_librefs;
-static VALUE rb_features;
static st_table *loading_tbl;
-NORETURN(void jump_tag_but_local_jump(int, VALUE));
-
#define IS_SOEXT(e) (strcmp(e, ".so") == 0 || strcmp(e, ".o") == 0)
#ifdef DLEXT2
#define IS_DLEXT(e) (strcmp(e, DLEXT) == 0 || strcmp(e, DLEXT2) == 0)
@@ -19,6 +16,12 @@ NORETURN(void jump_tag_but_local_jump(int, VALUE));
#define IS_DLEXT(e) (strcmp(e, DLEXT) == 0)
#endif
+static VALUE
+get_loaded_features(void)
+{
+ return GET_VM()->loaded_features;
+}
+
static int
rb_feature_p(const char *feature, const char *ext, int rb)
{
@@ -34,8 +37,8 @@ rb_feature_p(const char *feature, const char *ext, int rb)
len = strlen(feature);
elen = 0;
}
- for (i = 0; i < RARRAY_LEN(rb_features); ++i) {
- v = RARRAY_PTR(rb_features)[i];
+ for (i = 0; i < RARRAY_LEN(get_loaded_features()); ++i) {
+ v = RARRAY_PTR(get_loaded_features())[i];
f = StringValuePtr(v);
if (strncmp(f, feature, len) != 0)
continue;
@@ -99,7 +102,7 @@ rb_provided(const char *feature)
static void
rb_provide_feature(VALUE feature)
{
- rb_ary_push(rb_features, feature);
+ rb_ary_push(get_loaded_features(), feature);
}
void
@@ -518,9 +521,9 @@ Init_load()
rb_define_readonly_variable("$-I", &rb_load_path);
rb_define_readonly_variable("$LOAD_PATH", &rb_load_path);
- rb_features = rb_ary_new();
- rb_define_readonly_variable("$\"", &rb_features);
- rb_define_readonly_variable("$LOADED_FEATURES", &rb_features);
+ rb_define_virtual_variable("$\"", get_loaded_features, 0);
+ rb_define_virtual_variable("$LOADED_FEATURES", get_loaded_features, 0);
+ GET_VM()->loaded_features = rb_ary_new();
rb_define_global_function("load", rb_f_load, -1);
rb_define_global_function("require", rb_f_require, 1);