aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
authorStefan Monnier2007-10-02 21:24:47 +0000
committerStefan Monnier2007-10-02 21:24:47 +0000
commit878f97ffedc5b4fc785beac809c3d4392f531eca (patch)
tree862d3533e412791972f9fd44fa4072d8173ff357 /src/fns.c
parent5b2f56dfa64ff88188ece5093589a52542163e46 (diff)
downloademacs-878f97ffedc5b4fc785beac809c3d4392f531eca.tar.gz
emacs-878f97ffedc5b4fc785beac809c3d4392f531eca.zip
* lisp.h (struct Lisp_Hash_Table): Move non-traced elements at the end.
Turn `count' into an integer. * fns.c (make_hash_table, hash_put, hash_remove, hash_clear) (sweep_weak_table, sweep_weak_hash_tables, Fhash_table_count): * print.c (print_object) <HASH_TABLE_P>: `count' is an int. * alloc.c (allocate_hash_table): Use ALLOCATE_PSEUDOVECTOR. (mark_object) <HASH_TABLE_P>: Use mark_vectorlike.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/fns.c b/src/fns.c
index d37b9d2c281..4c8693b3cca 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4598,7 +4598,7 @@ make_hash_table (test, size, rehash_size, rehash_threshold, weak,
4598 h->weak = weak; 4598 h->weak = weak;
4599 h->rehash_threshold = rehash_threshold; 4599 h->rehash_threshold = rehash_threshold;
4600 h->rehash_size = rehash_size; 4600 h->rehash_size = rehash_size;
4601 h->count = make_number (0); 4601 h->count = 0;
4602 h->key_and_value = Fmake_vector (make_number (2 * sz), Qnil); 4602 h->key_and_value = Fmake_vector (make_number (2 * sz), Qnil);
4603 h->hash = Fmake_vector (size, Qnil); 4603 h->hash = Fmake_vector (size, Qnil);
4604 h->next = Fmake_vector (size, Qnil); 4604 h->next = Fmake_vector (size, Qnil);
@@ -4778,7 +4778,7 @@ hash_put (h, key, value, hash)
4778 4778
4779 /* Increment count after resizing because resizing may fail. */ 4779 /* Increment count after resizing because resizing may fail. */
4780 maybe_resize_hash_table (h); 4780 maybe_resize_hash_table (h);
4781 h->count = make_number (XFASTINT (h->count) + 1); 4781 h->count++;
4782 4782
4783 /* Store key/value in the key_and_value vector. */ 4783 /* Store key/value in the key_and_value vector. */
4784 i = XFASTINT (h->next_free); 4784 i = XFASTINT (h->next_free);
@@ -4834,8 +4834,8 @@ hash_remove (h, key)
4834 HASH_KEY (h, i) = HASH_VALUE (h, i) = HASH_HASH (h, i) = Qnil; 4834 HASH_KEY (h, i) = HASH_VALUE (h, i) = HASH_HASH (h, i) = Qnil;
4835 HASH_NEXT (h, i) = h->next_free; 4835 HASH_NEXT (h, i) = h->next_free;
4836 h->next_free = make_number (i); 4836 h->next_free = make_number (i);
4837 h->count = make_number (XFASTINT (h->count) - 1); 4837 h->count--;
4838 xassert (XINT (h->count) >= 0); 4838 xassert (h->count >= 0);
4839 break; 4839 break;
4840 } 4840 }
4841 else 4841 else
@@ -4853,7 +4853,7 @@ void
4853hash_clear (h) 4853hash_clear (h)
4854 struct Lisp_Hash_Table *h; 4854 struct Lisp_Hash_Table *h;
4855{ 4855{
4856 if (XFASTINT (h->count) > 0) 4856 if (h->count > 0)
4857 { 4857 {
4858 int i, size = HASH_TABLE_SIZE (h); 4858 int i, size = HASH_TABLE_SIZE (h);
4859 4859
@@ -4869,7 +4869,7 @@ hash_clear (h)
4869 AREF (h->index, i) = Qnil; 4869 AREF (h->index, i) = Qnil;
4870 4870
4871 h->next_free = make_number (0); 4871 h->next_free = make_number (0);
4872 h->count = make_number (0); 4872 h->count = 0;
4873 } 4873 }
4874} 4874}
4875 4875
@@ -4939,7 +4939,7 @@ sweep_weak_table (h, remove_entries_p)
4939 HASH_KEY (h, i) = HASH_VALUE (h, i) = Qnil; 4939 HASH_KEY (h, i) = HASH_VALUE (h, i) = Qnil;
4940 HASH_HASH (h, i) = Qnil; 4940 HASH_HASH (h, i) = Qnil;
4941 4941
4942 h->count = make_number (XFASTINT (h->count) - 1); 4942 h->count--;
4943 } 4943 }
4944 else 4944 else
4945 { 4945 {
@@ -5005,7 +5005,7 @@ sweep_weak_hash_tables ()
5005 if (h->size & ARRAY_MARK_FLAG) 5005 if (h->size & ARRAY_MARK_FLAG)
5006 { 5006 {
5007 /* TABLE is marked as used. Sweep its contents. */ 5007 /* TABLE is marked as used. Sweep its contents. */
5008 if (XFASTINT (h->count) > 0) 5008 if (h->count > 0)
5009 sweep_weak_table (h, 1); 5009 sweep_weak_table (h, 1);
5010 5010
5011 /* Add table to the list of used weak hash tables. */ 5011 /* Add table to the list of used weak hash tables. */
@@ -5340,7 +5340,7 @@ DEFUN ("hash-table-count", Fhash_table_count, Shash_table_count, 1, 1, 0,
5340 (table) 5340 (table)
5341 Lisp_Object table; 5341 Lisp_Object table;
5342{ 5342{
5343 return check_hash_table (table)->count; 5343 return make_number (check_hash_table (table)->count);
5344} 5344}
5345 5345
5346 5346