Commit 0dfd9a69 authored by Paul Eggert's avatar Paul Eggert
Browse files

Simplify make-list implementation

* src/alloc.c (Fmake_list): Don’t unroll loop, as the complexity
is not worth it these days.
parent 44765de2
......@@ -2872,44 +2872,14 @@ usage: (list &rest OBJECTS) */)
DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0,
doc: /* Return a newly created list of length LENGTH, with each element being INIT. */)
(register Lisp_Object length, Lisp_Object init)
(Lisp_Object length, Lisp_Object init)
{
register Lisp_Object val;
register EMACS_INT size;
Lisp_Object val = Qnil;
CHECK_NATNUM (length);
size = XFASTINT (length);
val = Qnil;
while (size > 0)
for (EMACS_INT size = XFASTINT (length); 0 < size; size--)
{
val = Fcons (init, val);
--size;
if (size > 0)
{
val = Fcons (init, val);
--size;
if (size > 0)
{
val = Fcons (init, val);
--size;
if (size > 0)
{
val = Fcons (init, val);
--size;
if (size > 0)
{
val = Fcons (init, val);
--size;
}
}
}
}
QUIT;
}
......
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