From f25c052bf260c2655b8cfaf9c8e447e5940548af Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 27 Nov 2014 08:10:21 +0000 Subject: [PATCH] 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 --- ChangeLog | 4 ++++ template/prelude.c.tmpl | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc1a935fe8..819878132d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Nov 27 17:10:19 2014 Nobuyoshi Nakada + + * template/prelude.c.tmpl: no code if no prelude code is given. + Thu Nov 27 13:11:00 2014 Koichi Sasada * gc.c (objspace_malloc_increase): enable lazy sweep on GC by malloc() diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl index 1f00bd66ab..00230ab6be 100644 --- a/template/prelude.c.tmpl +++ b/template/prelude.c.tmpl @@ -65,6 +65,7 @@ Prelude.new(output && output[/\w+(?=_prelude.c\b)/] || 'prelude', ARGV, vpath).i sources: <%= @preludes.map {|n,*| prelude_base(n)}.join(', ') %> */ +%unless @preludes.empty? #include "ruby/ruby.h" #include "internal.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 +#define PRELUDE_COUNT <%=preludes.size%> + struct prelude_env { volatile VALUE prefix_path; #if PRELUDE_COUNT > 0 @@ -134,9 +135,11 @@ prelude_require(VALUE self, VALUE nth) } % end +%end void Init_<%=@init_name%>(void) { +%unless @preludes.empty? % if @have_sublib struct prelude_env memo; ID name = rb_intern("TMP_RUBY_PREFIX"); @@ -166,5 +169,6 @@ Init_<%=@init_name%>(void) puts(prelude_code<%=i%>); % } #endif +%end } <%end -%>