diff options
author | Gerd Moellmann <gerd@gnu.org> | 2001-01-24 16:10:06 +0000 |
---|---|---|
committer | Gerd Moellmann <gerd@gnu.org> | 2001-01-24 16:10:06 +0000 |
commit | 1e54671434073cafe9a6d350234ebbb5171ddef7 (patch) | |
tree | ff90da846adc9a1215df87029a2e281f2ca833cf /src/fns.c | |
parent | 2533b69a030cdbf4703096e3a637a2e51ecd6d4e (diff) | |
download | emacs-1e54671434073cafe9a6d350234ebbb5171ddef7.tar.gz |
(sweep_weak_table): Fix code taking items out of
the hash collision chain. Some cleanup.
Diffstat (limited to 'src/fns.c')
-rw-r--r-- | src/fns.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/fns.c b/src/fns.c index 26a03f56ef1..e31d065c017 100644 --- a/src/fns.c +++ b/src/fns.c @@ -4345,21 +4345,17 @@ sweep_weak_table (h, remove_entries_p) for (bucket = 0; bucket < n; ++bucket) { - Lisp_Object idx, prev; + Lisp_Object idx, next, prev; /* Follow collision chain, removing entries that don't survive this garbage collection. */ - idx = HASH_INDEX (h, bucket); prev = Qnil; - while (!GC_NILP (idx)) + for (idx = HASH_INDEX (h, bucket); !GC_NILP (idx); idx = next) { - int remove_p; int i = XFASTINT (idx); - Lisp_Object next; - int key_known_to_survive_p, value_known_to_survive_p; - - key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); - value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); + int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); + int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); + int remove_p; if (EQ (h->weak, Qkey)) remove_p = !key_known_to_survive_p; @@ -4380,7 +4376,7 @@ sweep_weak_table (h, remove_entries_p) { /* Take out of collision chain. */ if (GC_NILP (prev)) - HASH_INDEX (h, i) = next; + HASH_INDEX (h, bucket) = next; else HASH_NEXT (h, XFASTINT (prev)) = next; @@ -4413,8 +4409,6 @@ sweep_weak_table (h, remove_entries_p) } } } - - idx = next; } } |