aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-20 06:05:08 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-20 06:05:08 +0000
commit8754f619d51a67fc4df255c189c8ff744433dd6e (patch)
treed12e93d26985d01ba5b8d4a4d0aced083ad62378 /parse.y
parent12652453b2fc6498a95a491fc0aa5fc059fe9fff (diff)
downloadruby-8754f619d51a67fc4df255c189c8ff744433dd6e.tar.gz
parse.y (parser_initialize): avoid redundant zero-ing
TypedData_Make_Struct already initializes fields to zero by default, so there's no need to waste code re-zeroing them. Size reduction on 32-bit x86: text data bss dec hex filename 187231 2372 80 189683 2e4f3 parse.o.before 186939 2372 80 189391 2e3cf parse.o git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y36
1 files changed, 2 insertions, 34 deletions
diff --git a/parse.y b/parse.y
index 9cf30baf1c..6fb0fa0975 100644
--- a/parse.y
+++ b/parse.y
@@ -10547,46 +10547,14 @@ internal_id_gen(struct parser_params *parser)
static void
parser_initialize(struct parser_params *parser)
{
- parser->eofp = 0;
-
- parser->parser_lex_strterm = 0;
- parser->parser_cond_stack = 0;
- parser->parser_cmdarg_stack = 0;
- parser->parser_paren_nest = 0;
- parser->parser_lpar_beg = 0;
- parser->parser_brace_nest = 0;
- parser->parser_in_single = 0;
- parser->parser_in_def = 0;
- parser->parser_in_defined = 0;
- parser->parser_in_kwarg = 0;
- parser->parser_compile_for_eval = 0;
- parser->parser_tokenbuf = NULL;
- parser->parser_tokidx = 0;
- parser->parser_toksiz = 0;
- parser->parser_heredoc_end = 0;
+ /* note: we rely on TypedData_Make_Struct to set most fields to 0 */
parser->parser_command_start = TRUE;
- parser->parser_deferred_nodes = 0;
- parser->parser_lex_pbeg = 0;
- parser->parser_lex_p = 0;
- parser->parser_lex_pend = 0;
- parser->parser_lvtbl = 0;
- parser->parser_ruby__end__seen = 0;
- parser->parser_ruby_sourcefile = 0;
parser->parser_ruby_sourcefile_string = Qnil;
- parser->cur_arg = 0;
-#ifndef RIPPER
- parser->parser_eval_tree_begin = 0;
- parser->parser_eval_tree = 0;
-#else
+#ifdef RIPPER
parser->delayed = Qnil;
-
parser->result = Qnil;
parser->parsing_thread = Qnil;
parser->toplevel_p = TRUE;
- parser->error_p = FALSE;
-#endif
-#ifdef YYMALLOC
- parser->heap = NULL;
#endif
parser->enc = rb_utf8_encoding();
}