pic_gc_protect now returns a value
This commit is contained in:
parent
f2717910d0
commit
af80ba6b36
|
@ -121,7 +121,7 @@ struct pic_object *pic_obj_alloc_unsafe(pic_state *, size_t, enum pic_tt);
|
|||
void pic_free(pic_state *, void *);
|
||||
|
||||
void pic_gc_run(pic_state *);
|
||||
void pic_gc_protect(pic_state *, pic_value);
|
||||
pic_value pic_gc_protect(pic_state *, pic_value);
|
||||
int pic_gc_arena_preserve(pic_state *);
|
||||
void pic_gc_arena_restore(pic_state *, int);
|
||||
|
||||
|
|
6
src/gc.c
6
src/gc.c
|
@ -183,17 +183,19 @@ gc_protect(pic_state *pic, struct pic_object *obj)
|
|||
pic->arena[pic->arena_idx++] = obj;
|
||||
}
|
||||
|
||||
void
|
||||
pic_value
|
||||
pic_gc_protect(pic_state *pic, pic_value v)
|
||||
{
|
||||
struct pic_object *obj;
|
||||
|
||||
if (pic_vtype(v) != PIC_VTYPE_HEAP) {
|
||||
return;
|
||||
return v;
|
||||
}
|
||||
obj = pic_obj_ptr(v);
|
||||
|
||||
gc_protect(pic, obj);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in New Issue