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

(SCM_HASHTAB_BUCKET_LOC): Removed.

(scan_weak_hashtables): Rewrote its use with SCM_HASHTAB_BUCKET
and SCM_SET_HASHTAB_BUCKET.
This commit is contained in:
Marius Vollmer 2005-01-07 15:50:01 +00:00
parent 509759dd31
commit 12783367ec
2 changed files with 18 additions and 15 deletions

View file

@ -228,19 +228,24 @@ scan_weak_hashtables (void *dummy1 SCM_UNUSED,
int check_size_p = 0;
for (i = 0; i < n; ++i)
{
SCM *next_spine = SCM_HASHTABLE_BUCKET_LOC (h, i);
for (alist = *next_spine;
!scm_is_null (alist);
alist = SCM_CDR (alist))
if ((weak_car && UNMARKED_CELL_P (SCM_CAAR (alist)))
|| (weak_cdr && UNMARKED_CELL_P (SCM_CDAR (alist))))
{
*next_spine = SCM_CDR (alist);
SCM_HASHTABLE_DECREMENT (h);
check_size_p = 1;
}
else
next_spine = SCM_CDRLOC (alist);
SCM *next_spine = NULL;
alist = SCM_HASHTABLE_BUCKET (h, i);
while (scm_is_pair (alist))
{
if ((weak_car && UNMARKED_CELL_P (SCM_CAAR (alist)))
|| (weak_cdr && UNMARKED_CELL_P (SCM_CDAR (alist))))
{
if (next_spine)
*next_spine = SCM_CDR (alist);
else
SCM_SET_HASHTABLE_BUCKET (h, i, SCM_CDR (alist));
SCM_HASHTABLE_DECREMENT (h);
check_size_p = 1;
}
else
next_spine = SCM_CDRLOC (alist);
alist = SCM_CDR (alist);
}
}
if (check_size_p
&& SCM_HASHTABLE_N_ITEMS (h) < SCM_HASHTABLE_LOWER (h))

View file

@ -65,8 +65,6 @@ extern scm_t_bits scm_tc16_hashtable;
SCM_SIMPLE_VECTOR_REF (SCM_HASHTABLE_VECTOR (h), i)
#define SCM_SET_HASHTABLE_BUCKET(h, i, x) \
SCM_SIMPLE_VECTOR_SET (SCM_HASHTABLE_VECTOR (h), i, x)
#define SCM_HASHTABLE_BUCKET_LOC(h, i) \
SCM_SIMPLE_VECTOR_LOC (SCM_HASHTABLE_VECTOR (h), i)
typedef struct scm_t_hashtable {
int flags; /* properties of table */