From ec01271caed8c23b347b7d4a8f7f0eec41f86ffc Mon Sep 17 00:00:00 2001 From: mame Date: Mon, 8 Jan 2018 09:39:01 +0000 Subject: [PATCH] parse.y: Remove dispose_string I think that recycling the delimiter string objects doesn't pay its complexity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- node.c | 11 ----------- node.h | 1 - parse.y | 9 --------- 3 files changed, 21 deletions(-) diff --git a/node.c b/node.c index 370e6df5ce..abaaf19c7d 100644 --- a/node.c +++ b/node.c @@ -1136,14 +1136,3 @@ rb_ast_add_mark_object(rb_ast_t *ast, VALUE obj) { rb_ary_push(ast->mark_ary, obj); } - -void -rb_ast_delete_mark_object(rb_ast_t *ast, VALUE obj) -{ - long i; - for (i = 0; i < RARRAY_LEN(ast->mark_ary); i++) { - if (obj == RARRAY_AREF(ast->mark_ary, i)) { - RARRAY_ASET(ast->mark_ary, i, Qnil); - } - } -} diff --git a/node.h b/node.h index 488a8ce2ef..b18d96357a 100644 --- a/node.h +++ b/node.h @@ -479,7 +479,6 @@ void rb_ast_mark(rb_ast_t*); void rb_ast_dispose(rb_ast_t*); void rb_ast_free(rb_ast_t*); void rb_ast_add_mark_object(rb_ast_t*, VALUE); -void rb_ast_delete_mark_object(rb_ast_t*, VALUE); NODE *rb_ast_newnode(rb_ast_t*); void rb_ast_delete_node(rb_ast_t*, NODE *n); diff --git a/parse.y b/parse.y index e73c266cc2..95c7f9bf12 100644 --- a/parse.y +++ b/parse.y @@ -6123,14 +6123,6 @@ parser_regx_options(struct parser_params *parser) return options | RE_OPTION_ENCODING(kcode); } -static void -dispose_string(struct parser_params *parser, VALUE str) -{ - rb_ast_delete_mark_object(parser->ast, str); - rb_str_free(str); - rb_gc_force_recycle(str); -} - static int parser_tokadd_mbchar(struct parser_params *parser, int c) { @@ -6907,7 +6899,6 @@ parser_here_document(struct parser_params *parser, rb_strterm_heredoc_t *here) } if (nextc() == -1) { if (str) { - dispose_string(parser, str); str = 0; } goto error;