mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 20:30:28 +02:00
Use void *' instead of
GC_PTR' internally.
* libguile/finalizers.c, libguile/foreign.c, libguile/guardians.c, libguile/hashtab.c, libguile/numbers.c, libguile/ports.c, libguile/smob.c, libguile/struct.c, libguile/vectors.c, libguile/weaks.c: Use `void *' instead of `GC_PTR'.
This commit is contained in:
parent
bd5dea489b
commit
6922d92f96
10 changed files with 30 additions and 33 deletions
|
@ -40,7 +40,7 @@ void
|
||||||
scm_i_set_finalizer (void *obj, scm_t_finalizer_proc proc, void *data)
|
scm_i_set_finalizer (void *obj, scm_t_finalizer_proc proc, void *data)
|
||||||
{
|
{
|
||||||
GC_finalization_proc prev;
|
GC_finalization_proc prev;
|
||||||
GC_PTR prev_data;
|
void *prev_data;
|
||||||
GC_REGISTER_FINALIZER_NO_ORDER (obj, proc, data, &prev, &prev_data);
|
GC_REGISTER_FINALIZER_NO_ORDER (obj, proc, data, &prev, &prev_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ register_weak_reference (SCM from, SCM to)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
pointer_finalizer_trampoline (GC_PTR ptr, GC_PTR data)
|
pointer_finalizer_trampoline (void *ptr, void *data)
|
||||||
{
|
{
|
||||||
scm_t_pointer_finalizer finalizer = data;
|
scm_t_pointer_finalizer finalizer = data;
|
||||||
finalizer (SCM_POINTER_VALUE (PTR2SCM (ptr)));
|
finalizer (SCM_POINTER_VALUE (PTR2SCM (ptr)));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Copyright (C) 1998,1999,2000,2001, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
|
/* Copyright (C) 1998,1999,2000,2001, 2006, 2008, 2009, 2011,
|
||||||
*
|
* 2012 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* as published by the Free Software Foundation; either version 3 of
|
* as published by the Free Software Foundation; either version 3 of
|
||||||
|
@ -104,7 +105,7 @@ guardian_print (SCM guardian, SCM port, scm_print_state *pstate SCM_UNUSED)
|
||||||
/* Handle finalization of OBJ which is guarded by the guardians listed in
|
/* Handle finalization of OBJ which is guarded by the guardians listed in
|
||||||
GUARDIAN_LIST. */
|
GUARDIAN_LIST. */
|
||||||
static void
|
static void
|
||||||
finalize_guarded (GC_PTR ptr, GC_PTR finalizer_data)
|
finalize_guarded (void *ptr, void *finalizer_data)
|
||||||
{
|
{
|
||||||
SCM cell_pool;
|
SCM cell_pool;
|
||||||
SCM obj, guardian_list, proxied_finalizer;
|
SCM obj, guardian_list, proxied_finalizer;
|
||||||
|
@ -164,7 +165,7 @@ finalize_guarded (GC_PTR ptr, GC_PTR finalizer_data)
|
||||||
/* Re-register the finalizer that was in place before we installed this
|
/* Re-register the finalizer that was in place before we installed this
|
||||||
one. */
|
one. */
|
||||||
GC_finalization_proc finalizer, prev_finalizer;
|
GC_finalization_proc finalizer, prev_finalizer;
|
||||||
GC_PTR finalizer_data, prev_finalizer_data;
|
void *finalizer_data, *prev_finalizer_data;
|
||||||
|
|
||||||
finalizer = (GC_finalization_proc) SCM2PTR (SCM_CAR (proxied_finalizer));
|
finalizer = (GC_finalization_proc) SCM2PTR (SCM_CAR (proxied_finalizer));
|
||||||
finalizer_data = SCM2PTR (SCM_CDR (proxied_finalizer));
|
finalizer_data = SCM2PTR (SCM_CDR (proxied_finalizer));
|
||||||
|
@ -204,7 +205,7 @@ scm_i_guard (SCM guardian, SCM obj)
|
||||||
the very beginning of an object's lifetime (e.g., see `SCM_NEWSMOB')
|
the very beginning of an object's lifetime (e.g., see `SCM_NEWSMOB')
|
||||||
or by this function. */
|
or by this function. */
|
||||||
GC_finalization_proc prev_finalizer;
|
GC_finalization_proc prev_finalizer;
|
||||||
GC_PTR prev_data;
|
void *prev_data;
|
||||||
SCM guardians_for_obj, finalizer_data;
|
SCM guardians_for_obj, finalizer_data;
|
||||||
|
|
||||||
g->live++;
|
g->live++;
|
||||||
|
|
|
@ -814,10 +814,10 @@ scm_hash_fn_set_x (SCM table, SCM obj, SCM val,
|
||||||
SCM_SETCDR (pair, val);
|
SCM_SETCDR (pair, val);
|
||||||
|
|
||||||
if (SCM_NIMP (prev) && !SCM_NIMP (val))
|
if (SCM_NIMP (prev) && !SCM_NIMP (val))
|
||||||
GC_unregister_disappearing_link ((GC_PTR) SCM_CDRLOC (pair));
|
GC_unregister_disappearing_link ((void **) SCM_CDRLOC (pair));
|
||||||
else
|
else
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((GC_PTR) SCM_CDRLOC (pair),
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) SCM_CDRLOC (pair),
|
||||||
(GC_PTR) SCM2PTR (val));
|
SCM2PTR (val));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SCM_SETCDR (pair, val);
|
SCM_SETCDR (pair, val);
|
||||||
|
|
|
@ -179,7 +179,7 @@ static mpz_t z_negative_one;
|
||||||
|
|
||||||
/* Clear the `mpz_t' embedded in bignum PTR. */
|
/* Clear the `mpz_t' embedded in bignum PTR. */
|
||||||
static void
|
static void
|
||||||
finalize_bignum (GC_PTR ptr, GC_PTR data)
|
finalize_bignum (void *ptr, void *data)
|
||||||
{
|
{
|
||||||
SCM bignum;
|
SCM bignum;
|
||||||
|
|
||||||
|
|
|
@ -543,7 +543,7 @@ scm_i_pthread_mutex_t scm_i_port_table_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
|
||||||
/* Port finalization. */
|
/* Port finalization. */
|
||||||
|
|
||||||
|
|
||||||
static void finalize_port (GC_PTR, GC_PTR);
|
static void finalize_port (void *, void *);
|
||||||
|
|
||||||
/* Register a finalizer for PORT. */
|
/* Register a finalizer for PORT. */
|
||||||
static SCM_C_INLINE_KEYWORD void
|
static SCM_C_INLINE_KEYWORD void
|
||||||
|
@ -556,7 +556,7 @@ register_finalizer_for_port (SCM port)
|
||||||
|
|
||||||
/* Finalize the object (a port) pointed to by PTR. */
|
/* Finalize the object (a port) pointed to by PTR. */
|
||||||
static void
|
static void
|
||||||
finalize_port (GC_PTR ptr, GC_PTR data)
|
finalize_port (void *ptr, void *data)
|
||||||
{
|
{
|
||||||
long port_type;
|
long port_type;
|
||||||
SCM port = PTR2SCM (ptr);
|
SCM port = PTR2SCM (ptr);
|
||||||
|
|
|
@ -378,7 +378,7 @@ scm_gc_mark (SCM o)
|
||||||
|
|
||||||
/* Finalize SMOB by calling its SMOB type's free function, if any. */
|
/* Finalize SMOB by calling its SMOB type's free function, if any. */
|
||||||
static void
|
static void
|
||||||
finalize_smob (GC_PTR ptr, GC_PTR data)
|
finalize_smob (void *ptr, void *data)
|
||||||
{
|
{
|
||||||
SCM smob;
|
SCM smob;
|
||||||
size_t (* free_smob) (SCM);
|
size_t (* free_smob) (SCM);
|
||||||
|
|
|
@ -410,7 +410,7 @@ SCM_DEFINE (scm_struct_vtable_p, "struct-vtable?", 1, 0, 0,
|
||||||
|
|
||||||
/* Finalization: invoke the finalizer of the struct pointed to by PTR. */
|
/* Finalization: invoke the finalizer of the struct pointed to by PTR. */
|
||||||
static void
|
static void
|
||||||
struct_finalizer_trampoline (GC_PTR ptr, GC_PTR unused_data)
|
struct_finalizer_trampoline (void *ptr, void *unused_data)
|
||||||
{
|
{
|
||||||
SCM obj = PTR2SCM (ptr);
|
SCM obj = PTR2SCM (ptr);
|
||||||
scm_t_struct_finalize finalize = SCM_STRUCT_FINALIZER (obj);
|
scm_t_struct_finalize finalize = SCM_STRUCT_FINALIZER (obj);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006, 2008, 2009, 2010,
|
||||||
*
|
* 2011, 2012 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* as published by the Free Software Foundation; either version 3 of
|
* as published by the Free Software Foundation; either version 3 of
|
||||||
|
@ -277,9 +278,8 @@ scm_c_vector_set_x (SCM v, size_t k, SCM obj)
|
||||||
if (SCM_I_WVECTP (v))
|
if (SCM_I_WVECTP (v))
|
||||||
{
|
{
|
||||||
/* Make it a weak pointer. */
|
/* Make it a weak pointer. */
|
||||||
GC_PTR link = (GC_PTR) & ((SCM_I_VECTOR_WELTS (v))[k]);
|
SCM *link = & SCM_I_VECTOR_WELTS (v)[k];
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK (link,
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) link, SCM2PTR (obj));
|
||||||
(GC_PTR) SCM2PTR (obj));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (SCM_I_ARRAYP (v) && SCM_I_ARRAY_NDIM (v) == 1)
|
else if (SCM_I_ARRAYP (v) && SCM_I_ARRAY_NDIM (v) == 1)
|
||||||
|
@ -296,9 +296,8 @@ scm_c_vector_set_x (SCM v, size_t k, SCM obj)
|
||||||
if (SCM_I_WVECTP (vv))
|
if (SCM_I_WVECTP (vv))
|
||||||
{
|
{
|
||||||
/* Make it a weak pointer. */
|
/* Make it a weak pointer. */
|
||||||
GC_PTR link = (GC_PTR) & ((SCM_I_VECTOR_WELTS (vv))[k]);
|
SCM *link = & SCM_I_VECTOR_WELTS (vv)[k];
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK (link,
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) link, SCM2PTR (obj));
|
||||||
(GC_PTR) SCM2PTR (obj));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* Copyright (C) 1995,1996,1998,2000,2001, 2003, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1998, 2000, 2001, 2003, 2006, 2008, 2009, 2010,
|
||||||
*
|
* 2011, 2012 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
* as published by the Free Software Foundation; either version 3 of
|
* as published by the Free Software Foundation; either version 3 of
|
||||||
|
@ -63,8 +64,7 @@ scm_weak_car_pair (SCM car, SCM cdr)
|
||||||
|
|
||||||
if (SCM_NIMP (car))
|
if (SCM_NIMP (car))
|
||||||
/* Weak car cells make sense iff the car is non-immediate. */
|
/* Weak car cells make sense iff the car is non-immediate. */
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((GC_PTR) &cell->word_0,
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &cell->word_0, SCM2PTR (car));
|
||||||
(GC_PTR) SCM2PTR (car));
|
|
||||||
|
|
||||||
return (SCM_PACK (cell));
|
return (SCM_PACK (cell));
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,7 @@ scm_weak_cdr_pair (SCM car, SCM cdr)
|
||||||
|
|
||||||
if (SCM_NIMP (cdr))
|
if (SCM_NIMP (cdr))
|
||||||
/* Weak cdr cells make sense iff the cdr is non-immediate. */
|
/* Weak cdr cells make sense iff the cdr is non-immediate. */
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((GC_PTR) &cell->word_1,
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &cell->word_1, SCM2PTR (cdr));
|
||||||
(GC_PTR) SCM2PTR (cdr));
|
|
||||||
|
|
||||||
return (SCM_PACK (cell));
|
return (SCM_PACK (cell));
|
||||||
}
|
}
|
||||||
|
@ -99,11 +98,9 @@ scm_doubly_weak_pair (SCM car, SCM cdr)
|
||||||
cell->word_1 = cdr;
|
cell->word_1 = cdr;
|
||||||
|
|
||||||
if (SCM_NIMP (car))
|
if (SCM_NIMP (car))
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((GC_PTR) &cell->word_0,
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &cell->word_0, SCM2PTR (car));
|
||||||
(GC_PTR) SCM2PTR (car));
|
|
||||||
if (SCM_NIMP (cdr))
|
if (SCM_NIMP (cdr))
|
||||||
SCM_I_REGISTER_DISAPPEARING_LINK ((GC_PTR) &cell->word_1,
|
SCM_I_REGISTER_DISAPPEARING_LINK ((void **) &cell->word_1, SCM2PTR (cdr));
|
||||||
(GC_PTR) SCM2PTR (cdr));
|
|
||||||
|
|
||||||
return (SCM_PACK (cell));
|
return (SCM_PACK (cell));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue