From 777f951caf85c480a337d7259d002469ccf55a40 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 3 Mar 2014 22:49:59 +0900 Subject: [PATCH] pic_compile now unsafe to compilation error --- src/codegen.c | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/src/codegen.c b/src/codegen.c index 078167ec..6203ecb0 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -1413,8 +1413,8 @@ pic_codegen(pic_state *pic, pic_value obj) return destroy_codegen_state(state); } -static struct pic_irep * -compile(pic_state *pic, pic_value obj) +struct pic_proc * +pic_compile(pic_state *pic, pic_value obj) { struct pic_irep *irep; int ai = pic_gc_arena_preserve(pic); @@ -1471,30 +1471,7 @@ compile(pic_state *pic, pic_value obj) pic_gc_arena_restore(pic, ai); pic_gc_protect(pic, pic_obj_value(irep)); - return irep; -} - -struct pic_proc * -pic_compile(pic_state *pic, pic_value obj) -{ - struct pic_proc *proc; - jmp_buf jmp, *prev_jmp = pic->jmp; - - if (setjmp(jmp) == 0) { - pic->jmp = &jmp; - } - else { - /* error occured */ - proc = NULL; - goto exit; - } - - proc = pic_proc_new_irep(pic, compile(pic, obj), NULL); - - exit: - pic->jmp = prev_jmp; - - return proc; + return pic_proc_new_irep(pic, irep, NULL); } static size_t