From 0208ec4013a88fda2e590921c0dd4295d4c2ebde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 18 Jan 2009 12:50:18 +0100 Subject: [PATCH] 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 ()'. --- libguile/procs.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libguile/procs.c b/libguile/procs.c index 624eb558f..8a4b42646 100644 --- a/libguile/procs.c +++ b/libguile/procs.c @@ -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