summaryrefslogtreecommitdiff
path: root/libguile/struct.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2025-05-02 15:12:19 +0200
committerAndy Wingo <wingo@pobox.com>2025-05-02 15:50:49 +0200
commit9774b3e5518dc1e5e9b3eab15bc43e710bd783d2 (patch)
treee3132b59b806ffc19a3bd06bcfc192fedc745568 /libguile/struct.c
parent5e97645b81e7a5be0089d9d112faf9a6fea6bc81 (diff)
downloadguile-9774b3e5518dc1e5e9b3eab15bc43e710bd783d2.tar.gz
Prepare structs for new finalization API
* libguile/struct.h: * libguile/struct.c (scm_i_finalize_struct): New helper. (struct_finalizer_trampoline): Implement as shim.
Diffstat (limited to 'libguile/struct.c')
-rw-r--r--libguile/struct.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libguile/struct.c b/libguile/struct.c
index 3e220d9d0..671f7e14b 100644
--- a/libguile/struct.c
+++ b/libguile/struct.c
@@ -310,16 +310,21 @@ SCM_DEFINE (scm_struct_vtable_p, "struct-vtable?", 1, 0, 0,
/* Finalization: invoke the finalizer of the struct pointed to by PTR. */
-static void
-struct_finalizer_trampoline (void *ptr, void *unused_data)
+void
+scm_i_finalize_struct (struct scm_thread *thread, SCM obj)
{
- SCM obj = PTR2SCM (ptr);
scm_t_struct_finalize finalize = SCM_STRUCT_FINALIZER (obj);
if (finalize)
finalize (obj);
}
+static void
+struct_finalizer_trampoline (void *ptr, void *data)
+{
+ scm_i_finalize_struct (SCM_I_CURRENT_THREAD, PTR2SCM (ptr));
+}
+
/* A struct is a sequence of words preceded by a pointer to the struct's
vtable. The vtable reference is tagged with the struct tc3. */
static SCM