summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-02 05:12:04 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-02 05:12:04 (GMT)
commitaae22e34086553d30d071e2575c240f6f89550d3 (patch)
tree9c81d564bae95745494212191b1ff55693173e65 /ruby.c
parent0ec5a272f1981d678da0d464c249120bd5aafc38 (diff)
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 cec8307..9167b68 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);
}
}