From aee625fa34f12d6b9e78e05e879a76495daa50b4 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Mon, 3 Jul 2000 12:29:36 +0000 Subject: [PATCH] (sweep_weak_table): Mark only objects that are not marked already. --- src/ChangeLog | 3 +++ src/fns.c | 25 ++++++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9e30bff4191..1bc2bf0b8bb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2000-07-03 Gerd Moellmann + * fns.c (sweep_weak_table): Mark only objects that are not + marked already. + * frame.c (next_frame, prev_frame): If MINIBUF is a window, include those frames as candidates which have their focus redirected to the minibuffer frame. diff --git a/src/fns.c b/src/fns.c index 24107f2ddeb..680fec8cc62 100644 --- a/src/fns.c +++ b/src/fns.c @@ -4175,14 +4175,17 @@ sweep_weak_table (h, remove_entries_p) 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)); + if (EQ (h->weak, Qkey)) - remove_p = !survives_gc_p (HASH_KEY (h, i)); + remove_p = !key_known_to_survive_p; else if (EQ (h->weak, Qvalue)) - remove_p = !survives_gc_p (HASH_VALUE (h, i)); + remove_p = !value_known_to_survive_p; else if (EQ (h->weak, Qt)) - remove_p = (!survives_gc_p (HASH_KEY (h, i)) - || !survives_gc_p (HASH_VALUE (h, i))); + remove_p = !key_known_to_survive_p || !value_known_to_survive_p; else abort (); @@ -4214,9 +4217,17 @@ sweep_weak_table (h, remove_entries_p) if (!remove_p) { /* Make sure key and value survive. */ - mark_object (&HASH_KEY (h, i)); - mark_object (&HASH_VALUE (h, i)); - marked = 1; + if (!key_known_to_survive_p) + { + mark_object (&HASH_KEY (h, i)); + marked = 1; + } + + if (!value_known_to_survive_p) + { + mark_object (&HASH_VALUE (h, i)); + marked = 1; + } } } -- 2.39.2