comparison src/alloc.c @ 5475:248176c74e6b

Merge with trunk.
author Mats Lidell <matsl@xemacs.org>
date Sat, 23 Apr 2011 23:47:13 +0200
parents 4dee0387b9de af961911bcb2
children 58b38d5b32d0
comparison
equal deleted inserted replaced
5474:4dee0387b9de 5475:248176c74e6b
1461 1461
1462 Lisp_Object 1462 Lisp_Object
1463 listu (Lisp_Object first, ...) 1463 listu (Lisp_Object first, ...)
1464 { 1464 {
1465 Lisp_Object obj = Qnil; 1465 Lisp_Object obj = Qnil;
1466 Lisp_Object val; 1466
1467 va_list va; 1467 if (!UNBOUNDP (first))
1468
1469 va_start (va, first);
1470 val = first;
1471 while (!UNBOUNDP (val))
1472 { 1468 {
1473 obj = Fcons (val, obj); 1469 va_list va;
1470 Lisp_Object last, val;
1471
1472 last = obj = Fcons (first, Qnil);
1473 va_start (va, first);
1474 val = va_arg (va, Lisp_Object); 1474 val = va_arg (va, Lisp_Object);
1475 while (!UNBOUNDP (val))
1476 {
1477 last = XCDR (last) = Fcons (val, Qnil);
1478 val = va_arg (va, Lisp_Object);
1479 }
1480 va_end (va);
1475 } 1481 }
1476 va_end (va); 1482 return obj;
1477 return Fnreverse (obj);
1478 } 1483 }
1479 1484
1480 /* Return a list of arbitrary length, with length specified and remaining 1485 /* Return a list of arbitrary length, with length specified and remaining
1481 args making up the list. */ 1486 args making up the list. */
1482 1487
1483 Lisp_Object 1488 Lisp_Object
1484 listn (int num_args, ...) 1489 listn (int num_args, ...)
1485 { 1490 {
1486 int i;
1487 Lisp_Object obj = Qnil; 1491 Lisp_Object obj = Qnil;
1488 va_list va; 1492
1489 1493 if (num_args > 0)
1490 va_start (va, num_args); 1494 {
1491 for (i = 0; i < num_args; i++) 1495 va_list va;
1492 obj = Fcons (va_arg (va, Lisp_Object), obj); 1496 Lisp_Object last;
1493 va_end (va); 1497 int i;
1494 return Fnreverse (obj); 1498
1499 va_start (va, num_args);
1500 last = obj = Fcons (va_arg (va, Lisp_Object), Qnil);
1501 for (i = 1; i < num_args; i++)
1502 last = XCDR (last) = Fcons (va_arg (va, Lisp_Object), Qnil);
1503 va_end (va);
1504 }
1505 return obj;
1495 } 1506 }
1496 1507
1497 /* Return a list of arbitrary length, with length specified and an array 1508 /* Return a list of arbitrary length, with length specified and an array
1498 of elements. */ 1509 of elements. */
1499 1510