aboutsummaryrefslogtreecommitdiffstats
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-02 05:12:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-02 05:12:04 +0000
commit3acebabd38774e0902b3cbc4c3409d87bde13c7e (patch)
tree9c81d564bae95745494212191b1ff55693173e65 /ruby.c
parentd415175f31a0da15107ffa646eac10d44ca41a67 (diff)
downloadruby-3acebabd38774e0902b3cbc4c3409d87bde13c7e.tar.gz
ruby.c: copy initial load path marks
* ruby.c (process_options): also copy initial load path marks at setting load paths encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ruby.c b/ruby.c
index cec83079be..9167b6837b 100644
--- a/ruby.c
+++ b/ruby.c
@@ -396,6 +396,8 @@ dladdr_path(const void* addr)
}
#endif
+#define INITIAL_LOAD_PATH_MARK rb_intern_const("@gem_prelude_index")
+
void
ruby_init_loadpath_safe(int safe_level)
{
@@ -513,7 +515,7 @@ ruby_init_loadpath_safe(int safe_level)
ruby_push_include(getenv("RUBYLIB"), identical_path);
}
- id_initial_load_path_mark = rb_intern_const("@gem_prelude_index");
+ id_initial_load_path_mark = INITIAL_LOAD_PATH_MARK;
while (*paths) {
size_t len = strlen(paths);
VALUE path = RUBY_RELATIVE(paths, len);
@@ -1421,9 +1423,12 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
{
long i;
VALUE load_path = GET_VM()->load_path;
+ const ID id_initial_load_path_mark = INITIAL_LOAD_PATH_MARK;
for (i = 0; i < RARRAY_LEN(load_path); ++i) {
VALUE path = RARRAY_AREF(load_path, i);
+ int mark = rb_attr_get(path, id_initial_load_path_mark) == path;
path = rb_enc_associate(rb_str_dup(path), lenc);
+ if (mark) rb_ivar_set(path, id_initial_load_path_mark, path);
RARRAY_ASET(load_path, i, path);
}
}