Mercurial > emacs
diff src/fns.c @ 85021:a0c901e4e649
* 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.
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Tue, 02 Oct 2007 21:24:47 +0000 |
| parents | 65663fcd2caa |
| children | 5039706521c9 |
line wrap: on
line diff
--- a/src/fns.c Tue Oct 02 21:19:17 2007 +0000 +++ b/src/fns.c Tue Oct 02 21:24:47 2007 +0000 @@ -4598,7 +4598,7 @@ 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 @@ /* 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_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 @@ 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 @@ AREF (h->index, i) = Qnil; h->next_free = make_number (0); - h->count = make_number (0); + h->count = 0; } } @@ -4939,7 +4939,7 @@ 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 @@ 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 @@ (table) Lisp_Object table; { - return check_hash_table (table)->count; + return make_number (check_hash_table (table)->count); }
