1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 14:50:19 +02:00

Use `scm_gc_malloc ()' and friends when allocating the subr table.

* libguile/procs.c (subr_table_gc_hint): New.
  (scm_c_make_subr): Use `scm_gc_realloc ()' instead of `scm_realloc ()'.
  (scm_init_subr_table): Use `scm_gc_malloc ()' instead of `scm_malloc ()'.
This commit is contained in:
Ludovic Courtès 2009-01-18 12:50:18 +01:00
parent f48393a99b
commit 0208ec4013

View file

@ -47,6 +47,9 @@ scm_t_subr_entry *scm_subr_table;
static unsigned long scm_subr_table_size = 0;
static unsigned long scm_subr_table_room = 800;
/* Hint for `scm_gc_malloc ()' and friends. */
static const char subr_table_gc_hint[] = "subr table";
SCM
scm_c_make_subr (const char *name, long type, SCM (*fcn) ())
{
@ -57,8 +60,10 @@ scm_c_make_subr (const char *name, long type, SCM (*fcn) ())
{
long new_size = scm_subr_table_room * 3 / 2;
void *new_table
= scm_realloc ((char *) scm_subr_table,
sizeof (scm_t_subr_entry) * new_size);
= scm_gc_realloc (scm_subr_table,
sizeof (* scm_subr_table) * scm_subr_table_room,
sizeof (* scm_subr_table) * new_size,
subr_table_gc_hint);
scm_subr_table = new_table;
scm_subr_table_room = new_size;
}
@ -328,7 +333,8 @@ scm_init_subr_table ()
{
scm_subr_table
= ((scm_t_subr_entry *)
scm_malloc (sizeof (scm_t_subr_entry) * scm_subr_table_room));
scm_gc_malloc (sizeof (* scm_subr_table) * scm_subr_table_room,
subr_table_gc_hint));
}
void