diff options
Diffstat (limited to 'template')
-rw-r--r-- | template/builtin_binary.inc.tmpl | 10 | ||||
-rw-r--r-- | template/prelude.c.tmpl | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/template/builtin_binary.inc.tmpl b/template/builtin_binary.inc.tmpl index 787ced5f3d..2c2f071705 100644 --- a/template/builtin_binary.inc.tmpl +++ b/template/builtin_binary.inc.tmpl @@ -10,19 +10,19 @@ static const unsigned char <%= feature %>_bin[] = { % iseq \ % . to_binary \ % . each_byte \ -% . map(&:ord) \ -% . map{ '0x%02x' % _1 } \ % . each_slice(12) {|a| - <%= a.join(', ') %>, + <%= a.map{ '0x%02x,' % _1 }.join(' ') %> % } }; % } +#define BUILTIN_BIN(feature) \ + { #feature, feature ## _bin, sizeof(feature ## _bin), } static const struct builtin_binary builtin_binary[] = { % ary.each{|feature, | - { <%= feature.dump %>, <%= feature %>_bin, sizeof(<%= feature %>_bin), }, + BUILTIN_BIN(<%= feature %>), % } - { NULL, },<%# dummy entry %> + { NULL, },/* sentinel */ }; #define BUILTIN_BINARY_SIZE <%= ary.size %> diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl index 428c9f4d01..ebf9bc0693 100644 --- a/template/prelude.c.tmpl +++ b/template/prelude.c.tmpl @@ -140,8 +140,8 @@ static rb_ast_t * prelude_ast(VALUE name, VALUE code, int line) { rb_ast_t *ast = rb_parser_compile_string_path(rb_parser_new(), name, code, line); - if (!ast->body.root) { - rb_ast_dispose(ast); + if (!ast || !ast->body.root) { + if (ast) rb_ast_dispose(ast); rb_exc_raise(rb_errinfo()); } return ast; @@ -208,7 +208,7 @@ Init_<%=init_name%><%=%>(void) %unless @prelude_count.zero? % preludes.each do |i, prelude, lines, sub, start_line| % next if sub - prelude_eval(PRELUDE_CODE(<%=i%><%=%>), PRELUDE_NAME(<%=i%><%=%>), <%=start_line%>); + prelude_eval(PRELUDE_CODE(<%=i%><%=%>), PRELUDE_NAME(<%=i%><%=%>), <%=start_line%><%=%>); % end #if 0 |