aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
authorStefan Monnier2007-07-11 15:26:31 +0000
committerStefan Monnier2007-07-11 15:26:31 +0000
commit5bb7dfee821bc910d9848085b2ab6b78c70330f6 (patch)
treefc7550144c3d5eef56dbac6cf915bd527922cfc5 /src/fns.c
parent8991fa8fd3a215489a4e41182c35fd4a228f0f7a (diff)
downloademacs-5bb7dfee821bc910d9848085b2ab6b78c70330f6.tar.gz
emacs-5bb7dfee821bc910d9848085b2ab6b78c70330f6.zip
* lisp.h (struct Lisp_Hash_Table): Turn next_weak into a bare pointer.
* fns.c (weak_hash_tables): Rename from Vweak_hash_tables and turned from a Lisp_Object into a bare pointer. (make_hash_table, copy_hash_table, sweep_weak_hash_tables, init_fns): Adjust the code correspondingly.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/fns.c b/src/fns.c
index 3e0605bea29..fb9c446e35e 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4268,7 +4268,7 @@ base64_decode_1 (from, to, length, multibyte, nchars_return)
4268 4268
4269/* The list of all weak hash tables. Don't staticpro this one. */ 4269/* The list of all weak hash tables. Don't staticpro this one. */
4270 4270
4271Lisp_Object Vweak_hash_tables; 4271struct Lisp_Hash_Table *weak_hash_tables;
4272 4272
4273/* Various symbols. */ 4273/* Various symbols. */
4274 4274
@@ -4614,11 +4614,11 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak,
4614 4614
4615 /* Maybe add this hash table to the list of all weak hash tables. */ 4615 /* Maybe add this hash table to the list of all weak hash tables. */
4616 if (NILP (h->weak)) 4616 if (NILP (h->weak))
4617 h->next_weak = Qnil; 4617 h->next_weak = NULL;
4618 else 4618 else
4619 { 4619 {
4620 h->next_weak = Vweak_hash_tables; 4620 h->next_weak = weak_hash_tables;
4621 Vweak_hash_tables = table; 4621 weak_hash_tables = h;
4622 } 4622 }
4623 4623
4624 return table; 4624 return table;
@@ -4649,8 +4649,8 @@ copy_hash_table (h1)
4649 /* Maybe add this hash table to the list of all weak hash tables. */ 4649 /* Maybe add this hash table to the list of all weak hash tables. */
4650 if (!NILP (h2->weak)) 4650 if (!NILP (h2->weak))
4651 { 4651 {
4652 h2->next_weak = Vweak_hash_tables; 4652 h2->next_weak = weak_hash_tables;
4653 Vweak_hash_tables = table; 4653 weak_hash_tables = h2;
4654 } 4654 }
4655 4655
4656 return table; 4656 return table;
@@ -4969,13 +4969,12 @@ sweep_weak_table (h, remove_entries_p)
4969 4969
4970/* Remove elements from weak hash tables that don't survive the 4970/* Remove elements from weak hash tables that don't survive the
4971 current garbage collection. Remove weak tables that don't survive 4971 current garbage collection. Remove weak tables that don't survive
4972 from Vweak_hash_tables. Called from gc_sweep. */ 4972 from weak_hash_tables. Called from gc_sweep. */
4973 4973
4974void 4974void
4975sweep_weak_hash_tables () 4975sweep_weak_hash_tables ()
4976{ 4976{
4977 Lisp_Object table, used, next; 4977 struct Lisp_Hash_Table *h, *used, *next;
4978 struct Lisp_Hash_Table *h;
4979 int marked; 4978 int marked;
4980 4979
4981 /* Mark all keys and values that are in use. Keep on marking until 4980 /* Mark all keys and values that are in use. Keep on marking until
@@ -4987,9 +4986,8 @@ sweep_weak_hash_tables ()
4987 do 4986 do
4988 { 4987 {
4989 marked = 0; 4988 marked = 0;
4990 for (table = Vweak_hash_tables; !GC_NILP (table); table = h->next_weak) 4989 for (h = weak_hash_tables; h; h = h->next_weak)
4991 { 4990 {
4992 h = XHASH_TABLE (table);
4993 if (h->size & ARRAY_MARK_FLAG) 4991 if (h->size & ARRAY_MARK_FLAG)
4994 marked |= sweep_weak_table (h, 0); 4992 marked |= sweep_weak_table (h, 0);
4995 } 4993 }
@@ -4997,9 +4995,8 @@ sweep_weak_hash_tables ()
4997 while (marked); 4995 while (marked);
4998 4996
4999 /* Remove tables and entries that aren't used. */ 4997 /* Remove tables and entries that aren't used. */
5000 for (table = Vweak_hash_tables, used = Qnil; !GC_NILP (table); table = next) 4998 for (h = weak_hash_tables, used = NULL; h; h = next)
5001 { 4999 {
5002 h = XHASH_TABLE (table);
5003 next = h->next_weak; 5000 next = h->next_weak;
5004 5001
5005 if (h->size & ARRAY_MARK_FLAG) 5002 if (h->size & ARRAY_MARK_FLAG)
@@ -5010,11 +5007,11 @@ sweep_weak_hash_tables ()
5010 5007
5011 /* Add table to the list of used weak hash tables. */ 5008 /* Add table to the list of used weak hash tables. */
5012 h->next_weak = used; 5009 h->next_weak = used;
5013 used = table; 5010 used = h;
5014 } 5011 }
5015 } 5012 }
5016 5013
5017 Vweak_hash_tables = used; 5014 weak_hash_tables = used;
5018} 5015}
5019 5016
5020 5017
@@ -5915,7 +5912,7 @@ used if both `use-dialog-box' and this variable are non-nil. */);
5915void 5912void
5916init_fns () 5913init_fns ()
5917{ 5914{
5918 Vweak_hash_tables = Qnil; 5915 weak_hash_tables = NULL;
5919} 5916}
5920 5917
5921/* arch-tag: 787f8219-5b74-46bd-8469-7e1cc475fa31 5918/* arch-tag: 787f8219-5b74-46bd-8469-7e1cc475fa31