mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
0ec5a272f1
commit
aae22e3408
2 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Jul 2 14:12:01 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ruby.c (process_options): also copy initial load path marks at
|
||||
setting load paths encoding.
|
||||
|
||||
Thu Jul 2 12:26:11 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* test/rubygems/test_gem_server.rb (process_based_port): use
|
||||
|
|
7
ruby.c
7
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue