summaryrefslogtreecommitdiff
path: root/src/fns.c
diff options
context:
space:
mode:
authorPip Cet <pipcet@gmail.com>2019-07-13 21:44:27 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-07-13 21:45:27 -0700
commit1542d17324c46a1406355ed10a48a97f51014e90 (patch)
treed47032a80783c71b6ff8530c9c4abc9c3207942c /src/fns.c
parent61a79e88e4a29854af519bf0e48c3a71197e0ddd (diff)
downloademacs-1542d17324c46a1406355ed10a48a97f51014e90.tar.gz
Avoid returning negative numbers from `hash-table-count'
* src/fns.c (Fhash_table_count): Rehash argument if necessary.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fns.c b/src/fns.c
index 54dafe07ac8..238a37193c1 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4875,7 +4875,9 @@ DEFUN ("hash-table-count", Fhash_table_count, Shash_table_count, 1, 1, 0,
doc: /* Return the number of elements in TABLE. */)
(Lisp_Object table)
{
- return make_fixnum (check_hash_table (table)->count);
+ struct Lisp_Hash_Table *h = check_hash_table (table);
+ hash_rehash_if_needed (h);
+ return make_fixnum (h->count);
}