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

ruby-changes:56557

From: Nobuyoshi <ko1@a...>
Date: Mon, 15 Jul 2019 16:51:19 +0900 (JST)
Subject: [ruby-changes:56557] Nobuyoshi Nakada: 5e0d27a32f (master): Removed dead code

https://git.ruby-lang.org/ruby.git/commit/?id=5e0d27a32f

From 5e0d27a32f2b3f1242c9990acf83b7970b37bbce Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 15 Jul 2019 16:44:07 +0900
Subject: Removed dead code

If `emesg` is `Qundef`, it is not a message string and then `elen`
(the length of the message) is 0.  So `emesg` cannot be `Qundef` in
the `elen != 0` block.  Pointed out by Coverity Scan.

diff --git a/eval_error.c b/eval_error.c
index b0ee0f4..44d82e8 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -169,9 +169,10 @@ print_errinfo(const VALUE eclass, const VALUE errat, const VALUE emesg, const VA https://github.com/ruby/ruby/blob/trunk/eval_error.c#L169
 	    write_warn(str, "\n");
 	}
 	else {
+	    /* emesg is a String instance */
 	    const char *tail = 0;
 
-	    if (emesg == Qundef && highlight) write_warn(str, bold);
+	    if (highlight) write_warn(str, bold);
 	    if (RSTRING_PTR(epath)[0] == '#')
 		epath = 0;
 	    if ((tail = memchr(einfo, '\n', elen)) != 0) {
-- 
cgit v0.10.2


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

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