]> git.eshelyaron.com Git - emacs.git/commit
List lengths are always fixnums now
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 11 Jan 2019 05:35:31 +0000 (21:35 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 11 Jan 2019 05:39:56 +0000 (21:39 -0800)
commit470082de55f7b1c1cde8aabbb5b8de55b4b08f83
tree73f67a8951cdeb998a822fd38a6abd242b16199a
parent9609db9d98babfe8782a03aebe46176e57905c63
List lengths are always fixnums now

Without this patch, it was theoretically possible for a list
length to be a bignum, which means that safe-length could
signal an error (due to generating a too-large bignum) contrary
to its documentation.  Fix things to remove the theoretical
possibility, so that list lengths are always fixnums (and so
that list lenghts are always ptrdiff_t values too, since that
is assumed internally anyway).
* src/alloc.c (Fcons): Do not allocate so many conses that
a list length won’t fit into ptrdiff_t or into fixnum.
This matters only on weird platforms; on typical platforms,
list lengths always fit anyway.
* src/fns.c (list_length, Fsafe_length, proper-list-p):
Remove integer overflow checks that are no longer needed.
src/alloc.c
src/fns.c