dont consume arena in pic_append
This commit is contained in:
parent
93e7a1cf32
commit
c2a1ea6748
14
src/pair.c
14
src/pair.c
|
@ -138,17 +138,17 @@ pic_value
|
||||||
pic_append(pic_state *pic, pic_value xs, pic_value ys)
|
pic_append(pic_state *pic, pic_value xs, pic_value ys)
|
||||||
{
|
{
|
||||||
int ai = pic_gc_arena_preserve(pic);
|
int ai = pic_gc_arena_preserve(pic);
|
||||||
|
pic_value x;
|
||||||
|
|
||||||
if (pic_nil_p(xs)) {
|
xs = pic_reverse(pic, xs);
|
||||||
return ys;
|
pic_for_each (x, xs) {
|
||||||
}
|
ys = pic_cons(pic, x, ys);
|
||||||
else {
|
|
||||||
xs = pic_cons(pic, pic_car(pic, xs), pic_append(pic, pic_cdr(pic, xs), ys));
|
|
||||||
}
|
|
||||||
|
|
||||||
pic_gc_arena_restore(pic, ai);
|
pic_gc_arena_restore(pic, ai);
|
||||||
pic_gc_protect(pic, xs);
|
pic_gc_protect(pic, xs);
|
||||||
return xs;
|
pic_gc_protect(pic, ys);
|
||||||
|
}
|
||||||
|
return ys;
|
||||||
}
|
}
|
||||||
|
|
||||||
pic_value
|
pic_value
|
||||||
|
|
Loading…
Reference in New Issue