diff src/undo.c @ 7671:31d444fcae24

(Fprimitive_undo): GCPRO next and list. Check argument type before calling XINT.
author Karl Heuer <kwzh@gnu.org>
date Wed, 25 May 1994 02:22:08 +0000
parents 99e9c133a752
children c0287cefc0f8
line wrap: on
line diff
--- a/src/undo.c	Tue May 24 21:16:23 1994 +0000
+++ b/src/undo.c	Wed May 25 02:22:08 1994 +0000
@@ -335,8 +335,10 @@
   (n, list)
      Lisp_Object n, list;
 {
+  struct gcpro gcpro1, gcpro2;
+  Lisp_Object next;
   int count = specpdl_ptr - specpdl;
-  register int arg = XINT (n);
+  register int arg;
 #if 0  /* This is a good feature, but would make undo-start
 	  unable to do what is expected.  */
   Lisp_Object tem;
@@ -348,6 +350,11 @@
     list = Fcdr (list);
 #endif
 
+  CHECK_NUMBER (n, 0);
+  arg = XINT (n);
+  next = Qnil;
+  GCPRO2 (next, list);
+
   /* Don't let read-only properties interfere with undo.  */
   if (NILP (current_buffer->read_only))
     specbind (Qinhibit_read_only, Qt);
@@ -356,7 +363,6 @@
     {
       while (1)
 	{
-	  Lisp_Object next;
 	  next = Fcar (list);
 	  list = Fcdr (list);
 	  /* Exit inner loop at undo boundary.  */
@@ -455,6 +461,7 @@
       arg--;
     }
 
+  UNGCPRO;
   return unbind_to (count, list);
 }