summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-31 18:26:57 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-31 18:26:57 -0700
commit8c63f55f7731bb8503c898ede73207bec0614661 (patch)
tree585b9d28070c383c81f2bf2505406aaa3b0cbea2
parent1bf965ceb66aa0ebc0404df306b6563253af9f1a (diff)
downloadtxr-8c63f55f7731bb8503c898ede73207bec0614661.tar.gz
txr-8c63f55f7731bb8503c898ede73207bec0614661.tar.bz2
txr-8c63f55f7731bb8503c898ede73207bec0614661.zip
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.
-rw-r--r--ffi.c20
1 files changed, 15 insertions, 5 deletions
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 =