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

ruby-changes:36484

From: akr <ko1@a...>
Date: Wed, 26 Nov 2014 00:22:17 +0900 (JST)
Subject: [ruby-changes:36484] akr:r48566 (trunk): * template/prelude.c.tmpl: Don't expand RbConfig::Config[...].

akr	2014-11-26 00:22:01 +0900 (Wed, 26 Nov 2014)

  New Revision: 48566

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

  Log:
    * template/prelude.c.tmpl: Don't expand RbConfig::Config[...].
      It is not used now.
    
    * common.mk: prelude.c and golf_prelude.c doesn't depend on rbconfig.

  Modified files:
    trunk/ChangeLog
    trunk/common.mk
    trunk/template/prelude.c.tmpl
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48565)
+++ ChangeLog	(revision 48566)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Nov 26 00:20:48 2014  Tanaka Akira  <akr@f...>
+
+	* template/prelude.c.tmpl: Don't expand RbConfig::Config[...].
+	  It is not used now.
+
+	* common.mk: prelude.c and golf_prelude.c doesn't depend on rbconfig.
+
 Tue Nov 25 17:07:06 2014  Koichi Sasada  <ko1@a...>
 
 	* NEWS: add an "Implementation changes" section.
Index: common.mk
===================================================================
--- common.mk	(revision 48565)
+++ common.mk	(revision 48566)
@@ -774,7 +774,7 @@ $(MINIPRELUDE_C): $(COMPILE_PRELUDE) {$( https://github.com/ruby/ruby/blob/trunk/common.mk#L774
 	$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -o $@ \
 		$(srcdir)/template/prelude.c.tmpl prelude.rb
 
-$(PRELUDE_C): $(COMPILE_PRELUDE) $(RBCONFIG) \
+$(PRELUDE_C): $(COMPILE_PRELUDE) \
 	   {$(srcdir)}lib/rubygems/defaults.rb \
 	   {$(srcdir)}lib/rubygems/core_ext/kernel_gem.rb \
 	   $(PRELUDE_SCRIPTS) $(PREP) $(LIB_SRCS)
@@ -782,7 +782,7 @@ $(PRELUDE_C): $(COMPILE_PRELUDE) $(RBCON https://github.com/ruby/ruby/blob/trunk/common.mk#L782
 	$(Q) $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -c -o $@ \
 		$(srcdir)/template/prelude.c.tmpl $(PRELUDE_SCRIPTS)
 
-{$(VPATH)}golf_prelude.c: $(COMPILE_PRELUDE) $(RBCONFIG) {$(srcdir)}golf_prelude.rb $(PREP)
+{$(VPATH)}golf_prelude.c: $(COMPILE_PRELUDE) {$(srcdir)}golf_prelude.rb $(PREP)
 	$(ECHO) generating $@
 	$(Q) $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -c -o $@ \
 		$(srcdir)/template/prelude.c.tmpl golf_prelude.rb
Index: template/prelude.c.tmpl
===================================================================
--- template/prelude.c.tmpl	(revision 48565)
+++ template/prelude.c.tmpl	(revision 48566)
@@ -28,9 +28,7 @@ class Prelude https://github.com/ruby/ruby/blob/trunk/template/prelude.c.tmpl#L28
 
   def initialize(init_name, preludes, vpath)
     @init_name = init_name
-    @mkconf = nil
     @have_sublib = false
-    @need_ruby_prefix = false
     @vpath = vpath
     @preludes = {}
     @mains = preludes.map {|filename| translate(filename)[0]}
@@ -45,20 +43,6 @@ class Prelude https://github.com/ruby/ruby/blob/trunk/template/prelude.c.tmpl#L43
     @vpath.foreach(filename) do |line|
       @preludes[filename] ||= result
       line.sub!(/(?:^|\s+)\#(?:$|\s.*)/, '')
-      line.gsub!(/RbConfig::CONFIG\["(\w+)"\]/) {
-        key = $1
-        unless @mkconf
-          require './rbconfig'
-          @mkconf = RbConfig::MAKEFILE_CONFIG.merge('prefix'=>'#{TMP_RUBY_PREFIX}')
-        end
-        if RbConfig::MAKEFILE_CONFIG.has_key? key
-          val = RbConfig.expand("$(#{key})", @mkconf)
-          @need_ruby_prefix ||= /\A\#\{TMP_RUBY_PREFIX\}/ =~ val
-          c_esc(val)
-        else
-          "nil"
-        end
-      }
       line.sub!(/require\s*\(?\s*(["'])(.*?)\1\)?/) do
         orig, path = $&, $2
         path = translate(path, true) rescue nil
@@ -98,7 +82,7 @@ static const char prelude_code<%=i%>[] = https://github.com/ruby/ruby/blob/trunk/template/prelude.c.tmpl#L82
 
 #define PRELUDE_COUNT <%=@have_sublib ? preludes.size : 0%>
 
-% if @have_sublib or @need_ruby_prefix
+% if @have_sublib
 struct prelude_env {
     volatile VALUE prefix_path;
 #if PRELUDE_COUNT > 0
@@ -153,7 +137,7 @@ prelude_require(VALUE self, VALUE nth) https://github.com/ruby/ruby/blob/trunk/template/prelude.c.tmpl#L137
 void
 Init_<%=@init_name%>(void)
 {
-% if @have_sublib or @need_ruby_prefix
+% if @have_sublib
     struct prelude_env memo;
     ID name = rb_intern("TMP_RUBY_PREFIX");
     VALUE prelude = Data_Wrap_Struct(rb_cData, 0, 0, &memo);
@@ -173,7 +157,7 @@ Init_<%=@init_name%>(void) https://github.com/ruby/ruby/blob/trunk/template/prelude.c.tmpl#L157
       rb_usascii_str_new(prelude_name<%=i%>, sizeof(prelude_name<%=i%>) - 1),
       INT2FIX(1));
 % end
-% if @have_sublib or @need_ruby_prefix
+% if @have_sublib
     rb_gc_force_recycle(prelude);
 % end
 

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

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