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

ruby-changes:56634

From: Yusuke <ko1@a...>
Date: Wed, 24 Jul 2019 04:50:52 +0900 (JST)
Subject: [ruby-changes:56634] Yusuke Endoh: a4e5690760 (master): transcode.c (rb_econv_open0): remove unused code

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

From a4e5690760c9177bc4234fdc5152d82ba73d26d0 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Wed, 24 Jul 2019 04:49:51 +0900
Subject: transcode.c (rb_econv_open0): remove unused code

Coverity Scan found this.

diff --git a/transcode.c b/transcode.c
index 0f72a2d..86ca57b 100644
--- a/transcode.c
+++ b/transcode.c
@@ -974,21 +974,10 @@ rb_econv_open0(const char *sname, const char *dname, int ecflags) https://github.com/ruby/ruby/blob/trunk/transcode.c#L974
     int num_trans;
     rb_econv_t *ec;
 
-    int sidx, didx;
-
-    if (*sname) {
-        sidx = rb_enc_find_index(sname);
-        if (0 <= sidx) {
-            rb_enc_from_index(sidx);
-        }
-    }
-
-    if (*dname) {
-        didx = rb_enc_find_index(dname);
-        if (0 <= didx) {
-            rb_enc_from_index(didx);
-        }
-    }
+    /* Just check if sname and dname are defined */
+    /* (This check is needed?) */
+    if (*sname) rb_enc_find_index(sname);
+    if (*dname) rb_enc_find_index(dname);
 
     if (*sname == '\0' && *dname == '\0') {
         num_trans = 0;
-- 
cgit v0.10.2


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

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