summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-27 08:10:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-27 08:10:21 +0000
commitf25c052bf260c2655b8cfaf9c8e447e5940548af (patch)
tree0b26279b6db67a1221d4b466e9911f39ab6e9ef0
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
-rw-r--r--ChangeLog4
-rw-r--r--template/prelude.c.tmpl8
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index cc1a935..8198781 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* 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 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 -%>