summaryrefslogtreecommitdiff
path: root/src/fns.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2007-10-02 21:24:47 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2007-10-02 21:24:47 +0000
commit878f97ffedc5b4fc785beac809c3d4392f531eca (patch)
tree862d3533e412791972f9fd44fa4072d8173ff357 /src/fns.c
parent5b2f56dfa64ff88188ece5093589a52542163e46 (diff)
downloademacs-878f97ffedc5b4fc785beac809c3d4392f531eca.tar.gz
emacs-878f97ffedc5b4fc785beac809c3d4392f531eca.tar.bz2
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,
h->weak = weak;
h->rehash_threshold = rehash_threshold;
h->rehash_size = rehash_size;
- h->count = make_number (0);
+ h->count = 0;
h->key_and_value = Fmake_vector (make_number (2 * sz), Qnil);
h->hash = Fmake_vector (size, Qnil);
h->next = Fmake_vector (size, Qnil);
@@ -4778,7 +4778,7 @@ hash_put (h, key, value, hash)
/* Increment count after resizing because resizing may fail. */
maybe_resize_hash_table (h);
- h->count = make_number (XFASTINT (h->count) + 1);
+ h->count++;
/* Store key/value in the key_and_value vector. */
i = XFASTINT (h->next_free);
@@ -4834,8 +4834,8 @@ hash_remove (h, key)
HASH_KEY (h, i) = HASH_VALUE (h, i) = HASH_HASH (h, i) = Qnil;
HASH_NEXT (h, i) = h->next_free;
h->next_free = make_number (i);
- h->count = make_number (XFASTINT (h->count) - 1);
- xassert (XINT (h->count) >= 0);
+ h->count--;
+ xassert (h->count >= 0);
break;
}
else
@@ -4853,7 +4853,7 @@ void
hash_clear (h)
struct Lisp_Hash_Table *h;
{
- if (XFASTINT (h->count) > 0)
+ if (h->count > 0)
{
int i, size = HASH_TABLE_SIZE (h);
@@ -4869,7 +4869,7 @@ hash_clear (h)
AREF (h->index, i) = Qnil;
h->next_free = make_number (0);
- h->count = make_number (0);
+ h->count = 0;
}
}
@@ -4939,7 +4939,7 @@ sweep_weak_table (h, remove_entries_p)
HASH_KEY (h, i) = HASH_VALUE (h, i) = Qnil;
HASH_HASH (h, i) = Qnil;
- h->count = make_number (XFASTINT (h->count) - 1);
+ h->count--;
}
else
{
@@ -5005,7 +5005,7 @@ sweep_weak_hash_tables ()
if (h->size & ARRAY_MARK_FLAG)
{
/* TABLE is marked as used. Sweep its contents. */
- if (XFASTINT (h->count) > 0)
+ if (h->count > 0)
sweep_weak_table (h, 1);
/* 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,
(table)
Lisp_Object table;
{
- return check_hash_table (table)->count;
+ return make_number (check_hash_table (table)->count);
}