summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-27 08:10:21 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-27 08:10:21 (GMT)
commitf25c052bf260c2655b8cfaf9c8e447e5940548af (patch)
tree0b26279b6db67a1221d4b466e9911f39ab6e9ef0 /template
parent1e4292a9d07f8d3d611705d6790968a188fee485 (diff)
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
Diffstat (limited to 'template')
-rw-r--r--template/prelude.c.tmpl8
1 files changed, 6 insertions, 2 deletions
diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl
index 1f00bd6..00230ab 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 -%>