changeset 62950:c698dd8981bd

(mapcar1): Maybe exit loop if original sequence was modified.
author Kim F. Storm <storm@cua.dk>
date Wed, 01 Jun 2005 11:42:19 +0000
parents c9728e8d054c
children dd0ee5cb03b2
files src/fns.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Wed Jun 01 11:42:00 2005 +0000
+++ b/src/fns.c	Wed Jun 01 11:42:19 2005 +0000
@@ -3132,9 +3132,9 @@
   else   /* Must be a list, since Flength did not get an error */
     {
       tail = seq;
-      for (i = 0; i < leni; i++)
+      for (i = 0; i < leni && CONSP (tail); i++)
 	{
-	  dummy = call1 (fn, Fcar (tail));
+	  dummy = call1 (fn, XCAR (tail));
 	  if (vals)
 	    vals[i] = dummy;
 	  tail = XCDR (tail);
@@ -3172,7 +3172,7 @@
   mapcar1 (leni, args, function, sequence);
   UNGCPRO;
 
-  for (i = leni - 1; i >= 0; i--)
+  for (i = leni - 1; i > 0; i--)
     args[i + i] = args[i];
 
   for (i = 1; i < nargs; i += 2)