mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
12652453b2
commit
8754f619d5
2 changed files with 6 additions and 34 deletions
|
@ -1,3 +1,7 @@
|
|||
Mon Jul 20 15:04:30 2015 Eric Wong <e@80x24.org>
|
||||
|
||||
* parse.y (parser_initialize): avoid redundant zero-ing
|
||||
|
||||
Mon Jul 20 12:12:05 2015 Eric Wong <e@80x24.org>
|
||||
|
||||
* parse.y (struct parser_params): pack: 88 => 256 bytes on 64-bit
|
||||
|
|
36
parse.y
36
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();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue