]> git.eshelyaron.com Git - emacs.git/commitdiff
* fns.c (weak_hash_tables): Rename from Vweak_hash_tables and change its type.
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 29 Jun 2007 03:48:22 +0000 (03:48 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 29 Jun 2007 03:48:22 +0000 (03:48 +0000)
(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.

src/ChangeLog
src/fns.c
src/lisp.h

index bfc4c3ac5f0a75b94a160d40c09b0ebc42094ad3..8d9793287bd889319bf5a13cd20322b3b761542e 100644 (file)
@@ -1,5 +1,13 @@
 2007-06-29  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * 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.
+
        * lisp.h (XGCTYPE, GC_HASH_TABLE_P, GC_NILP, GC_NUMBERP, GC_NATNUMP)
        (GC_INTEGERP, GC_SYMBOLP, GC_MISCP, GC_VECTORLIKEP, GC_STRINGP)
        (GC_CONSP, GC_FLOATP, GC_VECTORP, GC_OVERLAYP, GC_MARKERP)
index 4967569f023aa7bc950c4934b015123a97d52e26..854d6788e6864cbd15e8c81ad50c816e8e31371d 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -3641,7 +3641,7 @@ base64_decode_1 (from, to, length, multibyte, nchars_return)
 
 /* The list of all weak hash tables.  Don't staticpro this one.  */
 
-Lisp_Object Vweak_hash_tables;
+struct Lisp_Hash_Table *weak_hash_tables;
 
 /* Various symbols.  */
 
@@ -3987,11 +3987,11 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak,
 
   /* Maybe add this hash table to the list of all weak hash tables.  */
   if (NILP (h->weak))
-    h->next_weak = Qnil;
+    h->next_weak = NULL;
   else
     {
-      h->next_weak = Vweak_hash_tables;
-      Vweak_hash_tables = table;
+      h->next_weak = weak_hash_tables;
+      weak_hash_tables = h;
     }
 
   return table;
@@ -4022,8 +4022,8 @@ copy_hash_table (h1)
   /* Maybe add this hash table to the list of all weak hash tables.  */
   if (!NILP (h2->weak))
     {
-      h2->next_weak = Vweak_hash_tables;
-      Vweak_hash_tables = table;
+      h2->next_weak = weak_hash_tables;
+      weak_hash_tables = h2;
     }
 
   return table;
@@ -4347,8 +4347,7 @@ sweep_weak_table (h, remove_entries_p)
 void
 sweep_weak_hash_tables ()
 {
-  Lisp_Object table, used, next;
-  struct Lisp_Hash_Table *h;
+  struct Lisp_Hash_Table *h, *used, *next;
   int marked;
 
   /* Mark all keys and values that are in use.  Keep on marking until
@@ -4360,9 +4359,8 @@ sweep_weak_hash_tables ()
   do
     {
       marked = 0;
-      for (table = Vweak_hash_tables; !NILP (table); table = h->next_weak)
+      for (h = weak_hash_tables; h; h = h->next_weak)
        {
-         h = XHASH_TABLE (table);
          if (h->size & ARRAY_MARK_FLAG)
            marked |= sweep_weak_table (h, 0);
        }
@@ -4370,9 +4368,8 @@ sweep_weak_hash_tables ()
   while (marked);
 
   /* Remove tables and entries that aren't used.  */
-  for (table = Vweak_hash_tables, used = Qnil; !NILP (table); table = next)
+  for (h = weak_hash_tables, used = NULL; h; h = next)
     {
-      h = XHASH_TABLE (table);
       next = h->next_weak;
 
       if (h->size & ARRAY_MARK_FLAG)
@@ -4383,11 +4380,11 @@ sweep_weak_hash_tables ()
 
          /* Add table to the list of used weak hash tables.  */
          h->next_weak = used;
-         used = table;
+         used = h;
        }
     }
 
-  Vweak_hash_tables = used;
+  weak_hash_tables = used;
 }
 
 
@@ -5277,7 +5274,7 @@ used if both `use-dialog-box' and this variable are non-nil.  */);
 void
 init_fns ()
 {
-  Vweak_hash_tables = Qnil;
+  weak_hash_tables = NULL;
 }
 
 /* arch-tag: 787f8219-5b74-46bd-8469-7e1cc475fa31
index c8ca4c49ec675d03902b000e118857514269e38d..9f144c4c9735527d56b5a5f0ce57b6f7e9eb86e8 100644 (file)
@@ -1026,16 +1026,16 @@ struct Lisp_Hash_Table
      hash table size to reduce collisions.  */
   Lisp_Object index;
 
-  /* Next weak hash table if this is a weak hash table.  The head
-     of the list is in Vweak_hash_tables.  */
-  Lisp_Object next_weak;
-
   /* User-supplied hash function, or nil.  */
   Lisp_Object user_hash_function;
 
   /* User-supplied key comparison function, or nil.  */
   Lisp_Object user_cmp_function;
 
+  /* Next weak hash table if this is a weak hash table.  The head
+     of the list is in weak_hash_tables.  */
+  struct Lisp_Hash_Table *next_weak;
+
   /* C function to compare two keys.  */
   int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object,
                     unsigned, Lisp_Object, unsigned));