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

ruby-changes:59058

From: Yusuke <ko1@a...>
Date: Wed, 4 Dec 2019 08:24:15 +0900 (JST)
Subject: [ruby-changes:59058] f9754f0ea0 (master): compile.c: trivial refactoring

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

From f9754f0ea08e0d4fb28681a86cbc6ec2d884dba5 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Wed, 4 Dec 2019 08:22:48 +0900
Subject: compile.c: trivial refactoring

Use `for` instead of `while` to make it explicit that it is a traverse
of bytecode.

diff --git a/compile.c b/compile.c
index 1d5aa84..0b80834 100644
--- a/compile.c
+++ b/compile.c
@@ -2048,9 +2048,8 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) https://github.com/ruby/ruby/blob/trunk/compile.c#L2048
     if (stack_max < 0) return COMPILE_NG;
 
     /* fix label position */
-    list = FIRST_ELEMENT(anchor);
     insn_num = code_index = 0;
-    while (list) {
+    for (list = FIRST_ELEMENT(anchor); list; list = list->next) {
 	switch (list->type) {
 	  case ISEQ_ELEMENT_INSN:
 	    {
@@ -2109,7 +2108,6 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) https://github.com/ruby/ruby/blob/trunk/compile.c#L2108
 	    }
 	  default: break;
 	}
-	list = list->next;
     }
 
     /* make instruction sequence */
-- 
cgit v0.10.2


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

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