aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-12-04 08:22:48 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-12-04 08:22:48 +0900
commitf9754f0ea08e0d4fb28681a86cbc6ec2d884dba5 (patch)
treea016b9865180514f9df5c3651c3ea7af1a12f2d3 /compile.c
parent8852fa876039ed177fd5e867f36177d8a9ff411c (diff)
downloadruby-f9754f0ea08e0d4fb28681a86cbc6ec2d884dba5.tar.gz
compile.c: trivial refactoring
Use `for` instead of `while` to make it explicit that it is a traverse of bytecode.
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index 1d5aa843dd..0b808342c0 100644
--- a/compile.c
+++ b/compile.c
@@ -2048,9 +2048,8 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
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)
}
default: break;
}
- list = list->next;
}
/* make instruction sequence */