Simplify try-rescue loop

This commit is contained in:
Nobuyoshi Nakada 2023-08-06 13:32:27 +09:00
parent 89dbca894f
commit 1a83474ded
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2023-08-08 00:37:57 +00:00

View File

@ -165,9 +165,9 @@ rb_wasm_try_catch_loop_run(struct rb_wasm_try_catch *try_catch, rb_wasm_jmp_buf
break;
}
while (1) {
{
// catch longjmp with target jmp_buf
if (rb_asyncify_unwind_buf && _rb_wasm_active_jmpbuf == target) {
while (rb_asyncify_unwind_buf && _rb_wasm_active_jmpbuf == target) {
// do similar steps setjmp does when JMP_BUF_STATE_RETURNING
// stop unwinding
@ -182,14 +182,9 @@ rb_wasm_try_catch_loop_run(struct rb_wasm_try_catch *try_catch, rb_wasm_jmp_buf
if (try_catch->catch_f) {
try_catch->catch_f(try_catch->context);
}
continue;
} else if (rb_asyncify_unwind_buf /* unrelated unwind */) {
return;
}
// no unwind, then exit
break;
// no unwind or unrelated unwind, then exit
}
return;
}
void *