diff options
| author | Gerd Moellmann | 2001-01-24 16:10:06 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-01-24 16:10:06 +0000 |
| commit | 1e54671434073cafe9a6d350234ebbb5171ddef7 (patch) | |
| tree | ff90da846adc9a1215df87029a2e281f2ca833cf /src | |
| parent | 2533b69a030cdbf4703096e3a637a2e51ecd6d4e (diff) | |
| download | emacs-1e54671434073cafe9a6d350234ebbb5171ddef7.tar.gz emacs-1e54671434073cafe9a6d350234ebbb5171ddef7.zip | |
(sweep_weak_table): Fix code taking items out of
the hash collision chain. Some cleanup.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 18 |
1 files changed, 6 insertions, 12 deletions
| @@ -4345,21 +4345,17 @@ sweep_weak_table (h, remove_entries_p) | |||
| 4345 | 4345 | ||
| 4346 | for (bucket = 0; bucket < n; ++bucket) | 4346 | for (bucket = 0; bucket < n; ++bucket) |
| 4347 | { | 4347 | { |
| 4348 | Lisp_Object idx, prev; | 4348 | Lisp_Object idx, next, prev; |
| 4349 | 4349 | ||
| 4350 | /* Follow collision chain, removing entries that | 4350 | /* Follow collision chain, removing entries that |
| 4351 | don't survive this garbage collection. */ | 4351 | don't survive this garbage collection. */ |
| 4352 | idx = HASH_INDEX (h, bucket); | ||
| 4353 | prev = Qnil; | 4352 | prev = Qnil; |
| 4354 | while (!GC_NILP (idx)) | 4353 | for (idx = HASH_INDEX (h, bucket); !GC_NILP (idx); idx = next) |
| 4355 | { | 4354 | { |
| 4356 | int remove_p; | ||
| 4357 | int i = XFASTINT (idx); | 4355 | int i = XFASTINT (idx); |
| 4358 | Lisp_Object next; | 4356 | int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); |
| 4359 | int key_known_to_survive_p, value_known_to_survive_p; | 4357 | int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); |
| 4360 | 4358 | int remove_p; | |
| 4361 | key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); | ||
| 4362 | value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); | ||
| 4363 | 4359 | ||
| 4364 | if (EQ (h->weak, Qkey)) | 4360 | if (EQ (h->weak, Qkey)) |
| 4365 | remove_p = !key_known_to_survive_p; | 4361 | remove_p = !key_known_to_survive_p; |
| @@ -4380,7 +4376,7 @@ sweep_weak_table (h, remove_entries_p) | |||
| 4380 | { | 4376 | { |
| 4381 | /* Take out of collision chain. */ | 4377 | /* Take out of collision chain. */ |
| 4382 | if (GC_NILP (prev)) | 4378 | if (GC_NILP (prev)) |
| 4383 | HASH_INDEX (h, i) = next; | 4379 | HASH_INDEX (h, bucket) = next; |
| 4384 | else | 4380 | else |
| 4385 | HASH_NEXT (h, XFASTINT (prev)) = next; | 4381 | HASH_NEXT (h, XFASTINT (prev)) = next; |
| 4386 | 4382 | ||
| @@ -4413,8 +4409,6 @@ sweep_weak_table (h, remove_entries_p) | |||
| 4413 | } | 4409 | } |
| 4414 | } | 4410 | } |
| 4415 | } | 4411 | } |
| 4416 | |||
| 4417 | idx = next; | ||
| 4418 | } | 4412 | } |
| 4419 | } | 4413 | } |
| 4420 | 4414 | ||