mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Minor weak hashtables fixes.
* libguile/hashtab.c (scm_fixup_weak_alist): Cosmetic change. (scm_i_rehash): Call `SCM_HASHTABLE_DECREMENT ()' when a deleted weak pair is encountered. (scm_internal_hash_fold): Call `SCM_HASHTABLE_DECREMENT ()' instead of a complicated `SCM_SET_HASHTABLE_N_ITEMS ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-40
This commit is contained in:
parent
986ec82209
commit
72c9d17bf3
1 changed files with 8 additions and 12 deletions
|
@ -109,8 +109,7 @@ scm_fixup_weak_alist (SCM alist, size_t *removed_items)
|
|||
|
||||
if (scm_is_pair (pair))
|
||||
{
|
||||
if ((SCM_WEAK_PAIR_CAR_DELETED_P (pair))
|
||||
|| (SCM_WEAK_PAIR_CDR_DELETED_P (pair)))
|
||||
if (SCM_WEAK_PAIR_DELETED_P (pair))
|
||||
{
|
||||
/* Remove from ALIST weak pair PAIR whose car/cdr has been
|
||||
nullified by the GC. */
|
||||
|
@ -275,8 +274,11 @@ scm_i_rehash (SCM table,
|
|||
ls = SCM_CDR (ls);
|
||||
|
||||
if (SCM_WEAK_PAIR_DELETED_P (handle))
|
||||
/* HANDLE is a nullified weak pair: skip it. */
|
||||
continue;
|
||||
{
|
||||
/* HANDLE is a nullified weak pair: skip it. */
|
||||
SCM_HASHTABLE_DECREMENT (table);
|
||||
continue;
|
||||
}
|
||||
|
||||
h = hash_fn (SCM_CAR (handle), new_size, closure);
|
||||
if (h >= new_size)
|
||||
|
@ -1021,14 +1023,8 @@ scm_internal_hash_fold (SCM (*fn) (), void *closure, SCM init, SCM table)
|
|||
SCM_SIMPLE_VECTOR_SET (buckets, i, SCM_CDR (ls));
|
||||
|
||||
if (SCM_HASHTABLE_P (table))
|
||||
{
|
||||
/* Update the item count. */
|
||||
unsigned long items = SCM_HASHTABLE_N_ITEMS (table);
|
||||
|
||||
if (items <= 0)
|
||||
abort ();
|
||||
SCM_SET_HASHTABLE_N_ITEMS (table, items - 1);
|
||||
}
|
||||
/* Update the item count. */
|
||||
SCM_HASHTABLE_DECREMENT (table);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue