aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-07-11 15:26:31 +0000
committerStefan Monnier2007-07-11 15:26:31 +0000
commit5bb7dfee821bc910d9848085b2ab6b78c70330f6 (patch)
treefc7550144c3d5eef56dbac6cf915bd527922cfc5
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.
-rw-r--r--src/ChangeLog15
-rw-r--r--src/fns.c29
-rw-r--r--src/lisp.h10
3 files changed, 33 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ed9053e851a..df9ae72e2b8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12007-07-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * lisp.h (struct Lisp_Hash_Table): Turn next_weak into a bare pointer.
4 * fns.c (weak_hash_tables): Rename from Vweak_hash_tables and turned
5 from a Lisp_Object into a bare pointer.
6 (make_hash_table, copy_hash_table, sweep_weak_hash_tables, init_fns):
7 Adjust the code correspondingly.
8
9 * alloc.c (emacs_blocked_free): Remove unused var `bytes_used_now'.
10
11 * term.c: Include unistd.h for ttyname, used in handle_one_term_event.
12 (term_show_mouse_face): Remove unused var `j'.
13 (handle_one_term_event): Remove unused vars `i' and `j'.
14 Don't cast return value of ttyname since it's not necessary.
15
12007-07-10 Stefan Monnier <monnier@iro.umontreal.ca> 162007-07-10 Stefan Monnier <monnier@iro.umontreal.ca>
2 17
3 * alloc.c (mark_maybe_pointer): Enforce mult-of-8 alignment when using 18 * alloc.c (mark_maybe_pointer): Enforce mult-of-8 alignment when using
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
diff --git a/src/lisp.h b/src/lisp.h
index 6e77bf3e1ac..7cdd5536bb8 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -56,7 +56,7 @@ Boston, MA 02110-1301, USA. */
56#ifdef GC_CHECK_CONS_LIST 56#ifdef GC_CHECK_CONS_LIST
57#define CHECK_CONS_LIST() check_cons_list() 57#define CHECK_CONS_LIST() check_cons_list()
58#else 58#else
59#define CHECK_CONS_LIST() 0 59#define CHECK_CONS_LIST() ((void)0)
60#endif 60#endif
61 61
62/* These are default choices for the types to use. */ 62/* These are default choices for the types to use. */
@@ -1041,16 +1041,16 @@ struct Lisp_Hash_Table
1041 hash table size to reduce collisions. */ 1041 hash table size to reduce collisions. */
1042 Lisp_Object index; 1042 Lisp_Object index;
1043 1043
1044 /* Next weak hash table if this is a weak hash table. The head
1045 of the list is in Vweak_hash_tables. */
1046 Lisp_Object next_weak;
1047
1048 /* User-supplied hash function, or nil. */ 1044 /* User-supplied hash function, or nil. */
1049 Lisp_Object user_hash_function; 1045 Lisp_Object user_hash_function;
1050 1046
1051 /* User-supplied key comparison function, or nil. */ 1047 /* User-supplied key comparison function, or nil. */
1052 Lisp_Object user_cmp_function; 1048 Lisp_Object user_cmp_function;
1053 1049
1050 /* Next weak hash table if this is a weak hash table. The head
1051 of the list is in weak_hash_tables. */
1052 struct Lisp_Hash_Table *next_weak;
1053
1054 /* C function to compare two keys. */ 1054 /* C function to compare two keys. */
1055 int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object, 1055 int (* cmpfn) P_ ((struct Lisp_Hash_Table *, Lisp_Object,
1056 unsigned, Lisp_Object, unsigned)); 1056 unsigned, Lisp_Object, unsigned));