1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

prelude.c.tmpl: no preludes, no code.

* template/prelude.c.tmpl: no code if no prelude code is given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-11-27 08:10:21 +00:00
parent 1e4292a9d0
commit f25c052bf2
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Thu Nov 27 17:10:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* template/prelude.c.tmpl: no code if no prelude code is given.
Thu Nov 27 13:11:00 2014 Koichi Sasada <ko1@atdot.net> Thu Nov 27 13:11:00 2014 Koichi Sasada <ko1@atdot.net>
* gc.c (objspace_malloc_increase): enable lazy sweep on GC by malloc() * gc.c (objspace_malloc_increase): enable lazy sweep on GC by malloc()

View file

@ -65,6 +65,7 @@ Prelude.new(output && output[/\w+(?=_prelude.c\b)/] || 'prelude', ARGV, vpath).i
sources: <%= @preludes.map {|n,*| prelude_base(n)}.join(', ') %> sources: <%= @preludes.map {|n,*| prelude_base(n)}.join(', ') %>
*/ */
%unless @preludes.empty?
#include "ruby/ruby.h" #include "ruby/ruby.h"
#include "internal.h" #include "internal.h"
#include "vm_core.h" #include "vm_core.h"
@ -80,9 +81,9 @@ static const char prelude_code<%=i%>[] =
; ;
% } % }
#define PRELUDE_COUNT <%=@have_sublib ? preludes.size : 0%>
% if @have_sublib % if @have_sublib
#define PRELUDE_COUNT <%=preludes.size%>
struct prelude_env { struct prelude_env {
volatile VALUE prefix_path; volatile VALUE prefix_path;
#if PRELUDE_COUNT > 0 #if PRELUDE_COUNT > 0
@ -133,10 +134,12 @@ prelude_require(VALUE self, VALUE nth)
return Qtrue; return Qtrue;
} }
% end
%end %end
void void
Init_<%=@init_name%>(void) Init_<%=@init_name%>(void)
{ {
%unless @preludes.empty?
% if @have_sublib % if @have_sublib
struct prelude_env memo; struct prelude_env memo;
ID name = rb_intern("TMP_RUBY_PREFIX"); ID name = rb_intern("TMP_RUBY_PREFIX");
@ -166,5 +169,6 @@ Init_<%=@init_name%>(void)
puts(prelude_code<%=i%>); puts(prelude_code<%=i%>);
% } % }
#endif #endif
%end
} }
<%end -%> <%end -%>