From a6d2491338ed4467077b21bbfd3bf2e5c2ab3ffc Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Wed, 24 Sep 2014 20:27:16 +0900 Subject: [PATCH] don't perform longjmp in pic_load_point (for the symmetry) --- cont.c | 6 +++--- include/picrin/cont.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cont.c b/cont.c index a560fa72..56e6263e 100644 --- a/cont.c +++ b/cont.c @@ -73,7 +73,7 @@ pic_save_point(pic_state *pic, struct pic_escape *escape) escape->results = pic_undef_value(); } -noreturn void +void pic_load_point(pic_state *pic, struct pic_escape *escape) { if (! escape->valid) { @@ -91,8 +91,6 @@ pic_load_point(pic_state *pic, struct pic_escape *escape) pic->ip = escape->ip; escape->valid = false; - - longjmp(escape->jmp, 1); } noreturn static pic_value @@ -107,6 +105,8 @@ escape_call(pic_state *pic) e = pic_data_ptr(pic_attr_ref(pic, pic_get_proc(pic), "@@escape")); pic_load_point(pic, e->data); + + longjmp(((struct pic_escape *)e->data)->jmp, 1); } struct pic_proc * diff --git a/include/picrin/cont.h b/include/picrin/cont.h index 0b29cfda..3e948f73 100644 --- a/include/picrin/cont.h +++ b/include/picrin/cont.h @@ -27,7 +27,7 @@ struct pic_escape { }; void pic_save_point(pic_state *, struct pic_escape *); -noreturn void pic_load_point(pic_state *, struct pic_escape *); +void pic_load_point(pic_state *, struct pic_escape *); struct pic_proc *pic_make_econt(pic_state *, struct pic_escape *);