dont consume arena in pic_append

This commit is contained in:
Yuichi Nishiwaki 2014-02-11 16:22:17 +09:00
parent 93e7a1cf32
commit c2a1ea6748
1 changed files with 9 additions and 9 deletions

View File

@ -138,17 +138,17 @@ pic_value
pic_append(pic_state *pic, pic_value xs, pic_value ys)
{
int ai = pic_gc_arena_preserve(pic);
pic_value x;
if (pic_nil_p(xs)) {
return ys;
}
else {
xs = pic_cons(pic, pic_car(pic, xs), pic_append(pic, pic_cdr(pic, xs), ys));
}
xs = pic_reverse(pic, xs);
pic_for_each (x, xs) {
ys = pic_cons(pic, x, ys);
pic_gc_arena_restore(pic, ai);
pic_gc_protect(pic, xs);
return xs;
pic_gc_protect(pic, ys);
}
return ys;
}
pic_value