From 8c63f55f7731bb8503c898ede73207bec0614661 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku <kaz@kylheku.com> Date: Wed, 31 May 2017 18:26:57 -0700 Subject: ffi: bugfix: basic type needs proper mark function. * ffi.c (ffi_type_common_mark, ffi_type_mark): New static function (ffi_struct_type_mark, ffi_ptr_type_mark): Use new ffi_type_common_mark function for common members. (ffi_type_builtin_ops): Wire in ffi_type_mark. --- ffi.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'ffi.c') diff --git a/ffi.c b/ffi.c index 55f58c01..f07ba506 100644 --- a/ffi.c +++ b/ffi.c @@ -186,12 +186,23 @@ static void ffi_type_struct_destroy_op(val obj) free(tft); } +static void ffi_type_common_mark(struct txr_ffi_type *tft) +{ + gc_mark(tft->lt); + gc_mark(tft->syntax); +} + +static void ffi_type_mark(val obj) +{ + struct txr_ffi_type *tft = ffi_type_struct(obj); + ffi_type_common_mark(tft); +} + static void ffi_struct_type_mark(val obj) { struct txr_ffi_type *tft = ffi_type_struct(obj); cnum i; - gc_mark(tft->lt); - gc_mark(tft->syntax); + ffi_type_common_mark(tft); if (tft->eltype) gc_mark(tft->eltype); @@ -207,8 +218,7 @@ static void ffi_struct_type_mark(val obj) static void ffi_ptr_type_mark(val obj) { struct txr_ffi_type *tft = ffi_type_struct(obj); - gc_mark(tft->lt); - gc_mark(tft->syntax); + ffi_type_common_mark(tft); gc_mark(tft->eltype); } @@ -216,7 +226,7 @@ static struct cobj_ops ffi_type_builtin_ops = cobj_ops_init(eq, ffi_type_print_op, cobj_destroy_free_op, - cobj_mark_op, + ffi_type_mark, cobj_eq_hash_op); static struct cobj_ops ffi_type_struct_ops = -- cgit v1.2.3