1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-06 15:40:29 +02:00

Prepare structs for new finalization API

* libguile/struct.h:
* libguile/struct.c (scm_i_finalize_struct): New helper.
(struct_finalizer_trampoline): Implement as shim.
This commit is contained in:
Andy Wingo 2025-05-02 15:12:19 +02:00
parent 5e97645b81
commit 9774b3e551
2 changed files with 10 additions and 4 deletions

View file

@ -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