diff options
| author | Gerd Moellmann | 2000-08-07 12:04:06 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-08-07 12:04:06 +0000 |
| commit | ac0e96eefcdea2d4e61af557d629ff46db8da990 (patch) | |
| tree | 34e03c45e51dd78cf1719214c3542c3a9a09b843 /src/fns.c | |
| parent | ff3d95733df693020bbbaa4d5acfc99cd4d4c08b (diff) | |
| download | emacs-ac0e96eefcdea2d4e61af557d629ff46db8da990.tar.gz emacs-ac0e96eefcdea2d4e61af557d629ff46db8da990.zip | |
(sweep_weak_hash_tables): Fix the code taking unmarked
tables out of the list of all weak hash tables.
Diffstat (limited to 'src/fns.c')
| -rw-r--r-- | src/fns.c | 27 |
1 files changed, 12 insertions, 15 deletions
| @@ -4380,8 +4380,8 @@ sweep_weak_table (h, remove_entries_p) | |||
| 4380 | void | 4380 | void |
| 4381 | sweep_weak_hash_tables () | 4381 | sweep_weak_hash_tables () |
| 4382 | { | 4382 | { |
| 4383 | Lisp_Object table; | 4383 | Lisp_Object table, used, next; |
| 4384 | struct Lisp_Hash_Table *h, *prev; | 4384 | struct Lisp_Hash_Table *h; |
| 4385 | int marked; | 4385 | int marked; |
| 4386 | 4386 | ||
| 4387 | /* Mark all keys and values that are in use. Keep on marking until | 4387 | /* Mark all keys and values that are in use. Keep on marking until |
| @@ -4403,27 +4403,24 @@ sweep_weak_hash_tables () | |||
| 4403 | while (marked); | 4403 | while (marked); |
| 4404 | 4404 | ||
| 4405 | /* Remove tables and entries that aren't used. */ | 4405 | /* Remove tables and entries that aren't used. */ |
| 4406 | prev = NULL; | 4406 | for (table = Vweak_hash_tables, used = Qnil; !GC_NILP (table); table = next) |
| 4407 | for (table = Vweak_hash_tables; !GC_NILP (table); table = h->next_weak) | ||
| 4408 | { | 4407 | { |
| 4409 | prev = h; | ||
| 4410 | h = XHASH_TABLE (table); | 4408 | h = XHASH_TABLE (table); |
| 4411 | 4409 | next = h->next_weak; | |
| 4410 | |||
| 4412 | if (h->size & ARRAY_MARK_FLAG) | 4411 | if (h->size & ARRAY_MARK_FLAG) |
| 4413 | { | 4412 | { |
| 4413 | /* TABLE is marked as used. Sweep its contents. */ | ||
| 4414 | if (XFASTINT (h->count) > 0) | 4414 | if (XFASTINT (h->count) > 0) |
| 4415 | sweep_weak_table (h, 1); | 4415 | sweep_weak_table (h, 1); |
| 4416 | } | 4416 | |
| 4417 | else | 4417 | /* Add table to the list of used weak hash tables. */ |
| 4418 | { | 4418 | h->next_weak = used; |
| 4419 | /* Table is not marked, and will thus be freed. | 4419 | used = table; |
| 4420 | Take it out of the list of weak hash tables. */ | ||
| 4421 | if (prev) | ||
| 4422 | prev->next_weak = h->next_weak; | ||
| 4423 | else | ||
| 4424 | Vweak_hash_tables = h->next_weak; | ||
| 4425 | } | 4420 | } |
| 4426 | } | 4421 | } |
| 4422 | |||
| 4423 | Vweak_hash_tables = used; | ||
| 4427 | } | 4424 | } |
| 4428 | 4425 | ||
| 4429 | 4426 | ||