Commit 6346d301 authored by Paul Eggert's avatar Paul Eggert

* fns.c (Fnthcdr, Fsort): Don't assume list length fits in int.

parent e6966cd6
......@@ -9,6 +9,7 @@
(Flength): Report an error instead of overflowing an integer.
(Fsafe_length): Return a float if the value is not representable
as a fixnum. This shouldn't happen except in contrived situations.
(Fnthcdr, Fsort): Don't assume list length fits in int.
* alloc.c: Check that resized vectors' lengths fit in fixnums.
(header_size, word_size): New constants.
......
......@@ -1286,7 +1286,7 @@ DEFUN ("nthcdr", Fnthcdr, Snthcdr, 2, 2, 0,
doc: /* Take cdr N times on LIST, return the result. */)
(Lisp_Object n, Lisp_Object list)
{
register int i, num;
EMACS_INT i, num;
CHECK_NUMBER (n);
num = XINT (n);
for (i = 0; i < num && !NILP (list); i++)
......@@ -1751,7 +1751,7 @@ if the first element should sort before the second. */)
Lisp_Object front, back;
register Lisp_Object len, tem;
struct gcpro gcpro1, gcpro2;
register int length;
EMACS_INT length;
front = list;
len = Flength (list);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment