From 8fecbb1900c6c64feebad69f2f1e6d4d784d9202 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 1 Jul 2005 12:34:58 +0000 Subject: [PATCH] * gc-card.c (scm_i_card_statistics): init tag. * gc.c (tag_table_to_type_alist): check type of tag. Should be integer. --- libguile/ChangeLog | 9 ++++++++- libguile/gc-card.c | 2 +- libguile/gc.c | 26 +++++++++++++++----------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 24bc5ca8c..67f061a76 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,6 +1,13 @@ +2005-07-01 Han-Wen Nienhuys + + * gc-card.c (scm_i_card_statistics): init tag. + + * gc.c (tag_table_to_type_alist): check type of tag. Should be integer. + 2005-06-18 Han-Wen Nienhuys - * fports.c (s_scm_open_file): add the b flag for binary to the doc string. + * fports.c (s_scm_open_file): add the b flag for binary to the doc + string. 2005-06-25 Kevin Ryde diff --git a/libguile/gc-card.c b/libguile/gc-card.c index 21ece5497..3fd8a3056 100644 --- a/libguile/gc-card.c +++ b/libguile/gc-card.c @@ -308,7 +308,7 @@ scm_i_card_statistics (scm_t_cell *p, SCM hashtab, scm_t_heap_segment *seg) for (p += offset; p < end; p += span, offset += span) { - scm_t_bits tag; + scm_t_bits tag = -1; SCM scmptr = PTR2SCM (p); if (!SCM_C_BVEC_GET (bitvec, offset)) diff --git a/libguile/gc.c b/libguile/gc.c index b9269116a..382022c82 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -262,19 +262,23 @@ unsigned scm_newcell2_count; static SCM tag_table_to_type_alist (void *closure, SCM key, SCM val, SCM acc) { - scm_t_bits c_tag = scm_to_int (key); - - char const * name = scm_i_tag_name (c_tag); - if (name != NULL) - { - key = scm_from_locale_string (name); - } - else + if (scm_is_integer (key)) { - char s[100]; - sprintf (s, "tag %d", c_tag); - key = scm_from_locale_string (s); + scm_t_bits c_tag = scm_to_int (key); + + char const * name = scm_i_tag_name (c_tag); + if (name != NULL) + { + key = scm_from_locale_string (name); + } + else + { + char s[100]; + sprintf (s, "tag %d", c_tag); + key = scm_from_locale_string (s); + } } + return scm_cons (scm_cons (key, val), acc); } -- 2.20.1