mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 13:00:26 +02:00
Fix a bug in weak hash table bucket fixup.
* libguile/hashtab.c (scm_fixup_weak_alist): Keep the value of PREV unchanged after a nullified pair is deleted; this fixes a bug whereby if several successive nullified pairs were encountered, not all of them would be removed, and the assertion in `weak_bucket_assoc' would be hit. In addition, remove the `scm_is_pair (pair)' test.
This commit is contained in:
parent
08002eae4d
commit
dff58577d8
1 changed files with 13 additions and 13 deletions
|
@ -102,12 +102,10 @@ scm_fixup_weak_alist (SCM alist, size_t *removed_items)
|
||||||
*removed_items = 0;
|
*removed_items = 0;
|
||||||
for (result = alist;
|
for (result = alist;
|
||||||
scm_is_pair (alist);
|
scm_is_pair (alist);
|
||||||
prev = alist, alist = SCM_CDR (alist))
|
alist = SCM_CDR (alist))
|
||||||
{
|
{
|
||||||
SCM pair = SCM_CAR (alist);
|
SCM pair = SCM_CAR (alist);
|
||||||
|
|
||||||
if (scm_is_pair (pair))
|
|
||||||
{
|
|
||||||
if (SCM_WEAK_PAIR_DELETED_P (pair))
|
if (SCM_WEAK_PAIR_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
|
||||||
|
@ -118,9 +116,11 @@ scm_fixup_weak_alist (SCM alist, size_t *removed_items)
|
||||||
SCM_SETCDR (prev, SCM_CDR (alist));
|
SCM_SETCDR (prev, SCM_CDR (alist));
|
||||||
|
|
||||||
(*removed_items)++;
|
(*removed_items)++;
|
||||||
continue;
|
|
||||||
}
|
/* Leave PREV unchanged. */
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
prev = alist;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue