mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +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_is_pair (pair))
|
||||||
{
|
{
|
||||||
if ((SCM_WEAK_PAIR_CAR_DELETED_P (pair))
|
if (SCM_WEAK_PAIR_DELETED_P (pair))
|
||||||
|| (SCM_WEAK_PAIR_CDR_DELETED_P (pair)))
|
|
||||||
{
|
{
|
||||||
/* Remove from ALIST weak pair PAIR whose car/cdr has been
|
/* Remove from ALIST weak pair PAIR whose car/cdr has been
|
||||||
nullified by the GC. */
|
nullified by the GC. */
|
||||||
|
@ -275,8 +274,11 @@ scm_i_rehash (SCM table,
|
||||||
ls = SCM_CDR (ls);
|
ls = SCM_CDR (ls);
|
||||||
|
|
||||||
if (SCM_WEAK_PAIR_DELETED_P (handle))
|
if (SCM_WEAK_PAIR_DELETED_P (handle))
|
||||||
|
{
|
||||||
/* HANDLE is a nullified weak pair: skip it. */
|
/* HANDLE is a nullified weak pair: skip it. */
|
||||||
|
SCM_HASHTABLE_DECREMENT (table);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
h = hash_fn (SCM_CAR (handle), new_size, closure);
|
h = hash_fn (SCM_CAR (handle), new_size, closure);
|
||||||
if (h >= new_size)
|
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));
|
SCM_SIMPLE_VECTOR_SET (buckets, i, SCM_CDR (ls));
|
||||||
|
|
||||||
if (SCM_HASHTABLE_P (table))
|
if (SCM_HASHTABLE_P (table))
|
||||||
{
|
|
||||||
/* Update the item count. */
|
/* Update the item count. */
|
||||||
unsigned long items = SCM_HASHTABLE_N_ITEMS (table);
|
SCM_HASHTABLE_DECREMENT (table);
|
||||||
|
|
||||||
if (items <= 0)
|
|
||||||
abort ();
|
|
||||||
SCM_SET_HASHTABLE_N_ITEMS (table, items - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue