summaryrefslogtreecommitdiff
path: root/src/alloc.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/alloc.c
parent5b2f56dfa64ff88188ece5093589a52542163e46 (diff)
downloademacs-878f97ffedc5b4fc785beac809c3d4392f531eca.tar.gz
* 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/alloc.c')
-rw-r--r--src/alloc.c45
1 files changed, 7 insertions, 38 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 72e910f8faa..a3c9ec40f05 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2986,20 +2986,12 @@ allocate_pseudovector (memlen, lisplen, tag)
(VECSIZE (typ), PSEUDOVECSIZE (typ, field), tag))
struct Lisp_Hash_Table *
-allocate_hash_table ()
+allocate_hash_table (void)
{
- EMACS_INT len = VECSIZE (struct Lisp_Hash_Table);
- struct Lisp_Vector *v = allocate_vectorlike (len);
- EMACS_INT i;
+ return ALLOCATE_PSEUDOVECTOR (struct Lisp_Hash_Table, count, PVEC_HASH_TABLE);
+}
- v->size = len;
- for (i = 0; i < len; ++i)
- v->contents[i] = Qnil;
- return (struct Lisp_Hash_Table *) v;
-}
-
-
struct window *
allocate_window ()
{
@@ -5617,33 +5609,10 @@ mark_object (arg)
else if (GC_HASH_TABLE_P (obj))
{
struct Lisp_Hash_Table *h = XHASH_TABLE (obj);
-
- /* Stop if already marked. */
- if (VECTOR_MARKED_P (h))
- break;
-
- /* Mark it. */
- CHECK_LIVE (live_vector_p);
- VECTOR_MARK (h);
-
- /* Mark contents. */
- /* Do not mark next_free or next_weak.
- Being in the next_weak chain
- should not keep the hash table alive.
- No need to mark `count' since it is an integer. */
- mark_object (h->test);
- mark_object (h->weak);
- mark_object (h->rehash_size);
- mark_object (h->rehash_threshold);
- mark_object (h->hash);
- mark_object (h->next);
- mark_object (h->index);
- mark_object (h->user_hash_function);
- mark_object (h->user_cmp_function);
-
- /* If hash table is not weak, mark all keys and values.
- For weak tables, mark only the vector. */
- if (GC_NILP (h->weak))
+ if (mark_vectorlike ((struct Lisp_Vector *)h))
+ { /* If hash table is not weak, mark all keys and values.
+ For weak tables, mark only the vector. */
+ if (GC_NILP (h->weak))
mark_object (h->key_and_value);
else
VECTOR_MARK (XVECTOR (h->key_and_value));