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

ruby-changes:63566

From: Koichi <ko1@a...>
Date: Tue, 10 Nov 2020 10:46:53 +0900 (JST)
Subject: [ruby-changes:63566] b557c5768c (master): refactoring.

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

From b557c5768c7642d232a6a0268d6876651d40204b Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Tue, 10 Nov 2020 10:44:45 +0900
Subject: refactoring.

iv_index_tbl_newsize() usually returns iv_index_tbl->num_entries
because ivup->iv_extended is usually false.

diff --git a/variable.c b/variable.c
index 669d47e..3cead4b 100644
--- a/variable.c
+++ b/variable.c
@@ -1038,13 +1038,13 @@ gen_ivtbl_dup(const struct gen_ivtbl *orig) https://github.com/ruby/ruby/blob/trunk/variable.c#L1038
 static uint32_t
 iv_index_tbl_newsize(struct ivar_update *ivup)
 {
-    uint32_t index = (uint32_t)ivup->index;	/* should not overflow */
-    uint32_t newsize = (index+1) + (index+1)/4; /* (index+1)*1.25 */
-
     if (!ivup->iv_extended) {
-        newsize = (uint32_t)ivup->u.iv_index_tbl->num_entries;
+        return (uint32_t)ivup->u.iv_index_tbl->num_entries;
+    }
+    else {
+        uint32_t index = (uint32_t)ivup->index;	/* should not overflow */
+        return (index+1) + (index+1)/4; /* (index+1)*1.25 */
     }
-    return newsize;
 }
 
 static int
-- 
cgit v0.10.2


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

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