[前][次][番号順一覧][スレッド一覧]

ruby-changes:56550

From: Yusuke <ko1@a...>
Date: Mon, 15 Jul 2019 14:08:41 +0900 (JST)
Subject: [ruby-changes:56550] Yusuke Endoh: 711dfec3fa (master): parse.y (here_document): remove dead code

https://git.ruby-lang.org/ruby.git/commit/?id=711dfec3fa

From 711dfec3fa9623c5e8ef6f5ce3627f8f1a85f19d Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Mon, 15 Jul 2019 14:07:22 +0900
Subject: parse.y (here_document): remove dead code

str is always zero when evaluating the branch.
Found by Coverity Scan.

diff --git a/parse.y b/parse.y
index e006aba..6389730 100644
--- a/parse.y
+++ b/parse.y
@@ -7306,10 +7306,7 @@ here_document(struct parser_params *p, rb_strterm_heredoc_t *here) https://github.com/ruby/ruby/blob/trunk/parse.y#L7306
 	    dispatch_scan_event(p, tSTRING_CONTENT);
 	}
 	else {
-	    if (str) {
-		rb_str_append(p->delayed, str);
-	    }
-	    else if ((len = p->lex.pcur - p->lex.ptok) > 0) {
+	    if ((len = p->lex.pcur - p->lex.ptok) > 0) {
 		if (!(func & STR_FUNC_REGEXP) && rb_enc_asciicompat(enc)) {
 		    int cr = ENC_CODERANGE_UNKNOWN;
 		    rb_str_coderange_scan_restartable(p->lex.ptok, p->lex.pcur, enc, &cr);
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]