aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2007-06-29 03:48:22 +0000
committerStefan Monnier2007-06-29 03:48:22 +0000
commit6c661ec965ca0f1c9cf2b7e33ebe85eabef2e6fb (patch)
tree647ee14d8e5675af3f8cff86cefdb387c6973ecc /src
parent2706ceb633bedd382772741c0b73baef116d8eda (diff)
downloademacs-6c661ec965ca0f1c9cf2b7e33ebe85eabef2e6fb.tar.gz
emacs-6c661ec965ca0f1c9cf2b7e33ebe85eabef2e6fb.zip
* fns.c (weak_hash_tables): Rename from Vweak_hash_tables and change its type.
(make_hash_table, copy_hash_table, sweep_weak_hash_tables, init_fns): Update to the new type of weak_hash_tables and next_weak. * lisp.h (struct Lisp_Hash_Table): Change next_weak from Lisp_Object to a plain C pointer to Lisp_Hash_Table.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/fns.c27
-rw-r--r--src/lisp.h8
3 files changed, 24 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bfc4c3ac5f0..8d9793287bd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
12007-06-29 Stefan Monnier <monnier@iro.umontreal.ca> 12007-06-29 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * fns.c (weak_hash_tables): Rename from Vweak_hash_tables and change
4 its type.
5 (make_hash_table, copy_hash_table, sweep_weak_hash_tables, init_fns):
6 Update to the new type of weak_hash_tables and next_weak.
7
8 * lisp.h (struct Lisp_Hash_Table): Change next_weak from Lisp_Object to
9 a plain C pointer to Lisp_Hash_Table.
10
3 * lisp.h (XGCTYPE, GC_HASH_TABLE_P, GC_NILP, GC_NUMBERP, GC_NATNUMP) 11 * lisp.h (XGCTYPE, GC_HASH_TABLE_P, GC_NILP, GC_NUMBERP, GC_NATNUMP)
4 (GC_INTEGERP, GC_SYMBOLP, GC_MISCP, GC_VECTORLIKEP, GC_STRINGP) 12 (GC_INTEGERP, GC_SYMBOLP, GC_MISCP, GC_VECTORLIKEP, GC_STRINGP)
5 (GC_CONSP, GC_FLOATP, GC_VECTORP, GC_OVERLAYP, GC_MARKERP) 13 (GC_CONSP, GC_FLOATP, GC_VECTORP, GC_OVERLAYP, GC_MARKERP)
diff --git a/src/fns.c b/src/fns.c
index 4967569f023..854d6788e68 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3641,7 +3641,7 @@ base64_decode_1 (from, to, length, multibyte, nchars_return)
3641 3641
3642/* The list of all weak hash tables. Don't staticpro this one. */ 3642/* The list of all weak hash tables. Don't staticpro this one. */
3643 3643
3644Lisp_Object Vweak_hash_tables; 3644struct Lisp_Hash_Table *weak_hash_tables;
3645 3645
3646/* Various symbols. */ 3646/* Various symbols. */
3647 3647
@@ -3987,11 +3987,11 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak,
3987 3987
3988 /* Maybe add this hash table to the list of all weak hash tables. */ 3988 /* Maybe add this hash table to the list of all weak hash tables. */
3989 if (NILP (h->weak)) 3989 if (NILP (h->weak))
3990 h->next_weak = Qnil; 3990 h->next_weak = NULL;
3991 else 3991 else
3992 { 3992 {
3993 h->next_weak = Vweak_hash_tables; 3993 h->next_weak = weak_hash_tables;
3994 Vweak_hash_tables = table; 3994 weak_hash_tables = h;
3995 } 3995 }
3996 3996
3997 return table; 3997 return table;
@@ -4022,8 +4022,8 @@ copy_hash_table (h1)
4022 /* Maybe add this hash table to the list of all weak hash tables. */ 4022 /* Maybe add this hash table to the list of all weak hash tables. */
4023 if (!NILP (h2->weak)) 4023 if (!NILP (h2->weak))
4024 { 4024 {
4025 h2->next_weak = Vweak_hash_tables; 4025 h2->next_weak = weak_hash_tables;
4026 Vweak_hash_tables = table; 4026 weak_hash_tables = h2;
4027 } 4027 }
4028 4028
4029 return table; 4029 return table;
@@ -4347,8 +4347,7 @@ sweep_weak_table (h, remove_entries_p)
4347void 4347void
4348sweep_weak_hash_tables () 4348sweep_weak_hash_tables ()
4349{ 4349{
4350 Lisp_Object table, used, next; 4350 struct Lisp_Hash_Table *h, *used, *next;
4351 struct Lisp_Hash_Table *h;
4352 int marked; 4351 int marked;
4353 4352
4354 /* Mark all keys and values that are in use. Keep on marking until 4353 /* Mark all keys and values that are in use. Keep on marking until
@@ -4360,9 +4359,8 @@ sweep_weak_hash_tables ()
4360 do 4359 do
4361 { 4360 {
4362 marked = 0; 4361 marked = 0;
4363 for (table = Vweak_hash_tables; !NILP (table); table = h->next_weak) 4362 for (h = weak_hash_tables; h; h = h->next_weak)
4364 { 4363 {
4365 h = XHASH_TABLE (table);
4366 if (h->size & ARRAY_MARK_FLAG) 4364 if (h->size & ARRAY_MARK_FLAG)
4367 marked |= sweep_weak_table (h, 0); 4365 marked |= sweep_weak_table (h, 0);
4368 } 4366 }
@@ -4370,9 +4368,8 @@ sweep_weak_hash_tables ()
4370 while (marked); 4368 while (marked);
4371 4369
4372 /* Remove tables and entries that aren't used. */ 4370 /* Remove tables and entries that aren't used. */
4373 for (table = Vweak_hash_tables, used = Qnil; !NILP (table); table = next) 4371 for (h = weak_hash_tables, used = NULL; h; h = next)
4374 { 4372 {
4375 h = XHASH_TABLE (table);
4376 next = h->next_weak; 4373 next = h->next_weak;
4377 4374
4378 if (h->size & ARRAY_MARK_FLAG) 4375 if (h->size & ARRAY_MARK_FLAG)
@@ -4383,11 +4380,11 @@ sweep_weak_hash_tables ()
4383 4380
4384 /* Add table to the list of used weak hash tables. */ 4381 /* Add table to the list of used weak hash tables. */
4385 h->next_weak = used; 4382 h->next_weak = used;
4386 used = table; 4383 used = h;
4387 } 4384 }
4388 } 4385 }
4389 4386
4390 Vweak_hash_tables = used; 4387 weak_hash_tables = used;
4391} 4388}
4392 4389
4393 4390
@@ -5277,7 +5274,7 @@ used if both `use-dialog-box' and this variable are non-nil. */);
5277void 5274void
5278init_fns () 5275init_fns ()
5279{ 5276{
5280 Vweak_hash_tables = Qnil; 5277 weak_hash_tables = NULL;
5281} 5278}
5282 5279
5283/* arch-tag: 787f8219-5b74-46bd-8469-7e1cc475fa31 5280/* arch-tag: 787f8219-5b74-46bd-8469-7e1cc475fa31
diff --git a/src/lisp.h b/src/lisp.h
index c8ca4c49ec6..9f144c4c973 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1026,16 +1026,16 @@ struct Lisp_Hash_Table
1026 hash table size to reduce collisions. */ 1026 hash table size to reduce collisions. */
1027 Lisp_Object index; 1027 Lisp_Object index;
1028 1028
1029 /* Next weak hash table if this is a weak hash table. The head
1030 of the list is in Vweak_hash_tables. */
1031 Lisp_Object next_weak;
1032
1033 /* User-supplied hash function, or nil. */ 1029 /* User-supplied hash function, or nil. */
1034 Lisp_Object user_hash_function; 1030 Lisp_Object user_hash_function;
1035 1031
1036 /* User-supplied key comparison function, or nil. */ 1032 /* User-supplied key comparison function, or nil. */
1037 Lisp_Object user_cmp_function; 1033 Lisp_Object user_cmp_function;
1038 1034
1035 /* Next weak hash table if this is a weak hash table. The head
1036 of the list is in weak_hash_tables. */
1037 struct Lisp_Hash_Table *next_weak;
1038
1039 /* C function to compare two keys. */ 1039 /* C function to compare two keys. */
1040 int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object, 1040 int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object,
1041 unsigned, Lisp_Object, unsigned)); 1041 unsigned, Lisp_Object, unsigned));