summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/oasm/emit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/oasm/emit.c b/usr.bin/oasm/emit.c
index 0275d05..e3ee366 100644
--- a/usr.bin/oasm/emit.c
+++ b/usr.bin/oasm/emit.c
@@ -190,16 +190,17 @@ emit_process(struct oasm_state *oasm, struct emit_state *emit)
}
emit->out_fd = oasm->out_fd;
- TAILQ_FOREACH(curtok, &emit->ir, link) {
+ curtok = TAILQ_FIRST(&emit->ir);
+ while (curtok != NULL) {
switch (curtok->type) {
case TT_MOV:
curtok = emit_encode_mov(emit, curtok);
break;
- }
-
- if (curtok == NULL) {
+ default:
+ curtok = TAILQ_NEXT(curtok, link);
break;
}
+
}
return 0;