[前][次][番号順一覧][スレッド一覧]

ruby-changes:39022

From: nobu <ko1@a...>
Date: Thu, 2 Jul 2015 14:12:24 +0900 (JST)
Subject: [ruby-changes:39022] nobu:r51103 (trunk): ruby.c: copy initial load path marks

nobu	2015-07-02 14:12:04 +0900 (Thu, 02 Jul 2015)

  New Revision: 51103

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51103

  Log:
    ruby.c: copy initial load path marks
    
    * ruby.c (process_options): also copy initial load path marks at
      setting load paths encoding.

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51102)
+++ ChangeLog	(revision 51103)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jul  2 14:12:01 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* test/rubygems/test_gem_server.rb (process_based_port): use
Index: ruby.c
===================================================================
--- ruby.c	(revision 51102)
+++ ruby.c	(revision 51103)
@@ -396,6 +396,8 @@ dladdr_path(const void* addr) https://github.com/ruby/ruby/blob/trunk/ruby.c#L396
 }
 #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) https://github.com/ruby/ruby/blob/trunk/ruby.c#L515
 	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, s https://github.com/ruby/ruby/blob/trunk/ruby.c#L1423
     {
 	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);
 	}
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]