aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorMattias EngdegÄrd2023-11-04 15:16:38 +0100
committerMattias EngdegÄrd2024-01-13 20:50:38 +0100
commit49fd4d120deb0b878ad262aea7d849c7275bc12c (patch)
tree24c0547020d3283722b610fe5b13ae10f95c8524 /src/alloc.c
parentd3cefd3e98354929d96c9396e5920e8a123784dc (diff)
downloademacs-49fd4d120deb0b878ad262aea7d849c7275bc12c.tar.gz
emacs-49fd4d120deb0b878ad262aea7d849c7275bc12c.zip
Allow zero hash table size
This avoids any extra allocation for such vectors, including empty tables read by the Lisp reader, and provides extra safety essentially for free. * src/fns.c (make_hash_table): Allow tables to be 0-sized. The index will always have at least one entry, to avoid extra look-up costs. * src/alloc.c (process_mark_stack): Don't mark pure objects, because empty vectors are pure.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 17ed711a318..636b4972c84 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -7242,7 +7242,8 @@ process_mark_stack (ptrdiff_t base_sp)
7242 eassert (h->next_weak == NULL); 7242 eassert (h->next_weak == NULL);
7243 h->next_weak = weak_hash_tables; 7243 h->next_weak = weak_hash_tables;
7244 weak_hash_tables = h; 7244 weak_hash_tables = h;
7245 set_vector_marked (XVECTOR (h->key_and_value)); 7245 if (!PURE_P (h->key_and_value))
7246 set_vector_marked (XVECTOR (h->key_and_value));
7246 } 7247 }
7247 break; 7248 break;
7248 } 7249 }