changeset 970:0dc7756a58c4

[xemacs-hg @ 2002-08-22 11:31:39 by stephent] fix GCPRO in do_autoload <871y8rnndk.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Thu, 22 Aug 2002 11:31:43 +0000
parents d41e92ee6d12
children 8401dcd2d43a
files src/callint.c src/eval.c src/keymap.c src/lisp.h
diffstat 4 files changed, 16 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/callint.c	Thu Aug 22 11:19:58 2002 +0000
+++ b/src/callint.c	Thu Aug 22 11:31:43 2002 +0000
@@ -369,8 +369,9 @@
 
       if (EQ (funcar, Qautoload))
 	{
-	  struct gcpro gcpro1, gcpro2;
-	  GCPRO2 (function, prefix);
+	  struct gcpro gcpro1;
+	  GCPRO1 (prefix);
+	  /* do_autoload GCPROs both arguments */
 	  do_autoload (fun, function);
 	  UNGCPRO;
 	  goto retry;
--- a/src/eval.c	Thu Aug 22 11:19:58 2002 +0000
+++ b/src/eval.c	Thu Aug 22 11:31:43 2002 +0000
@@ -1403,6 +1403,7 @@
 	      if (EQ (tem, Qt) || EQ (tem, Qmacro))
 		{
 		  /* Yes, load it and try again.  */
+		  /* do_autoload GCPROs both arguments */
 		  do_autoload (def, sym);
 		  continue;
 		}
@@ -3036,7 +3037,10 @@
     {
       final = indirect_function (cmd, 1);
       if (CONSP (final) && EQ (Fcar (final), Qautoload))
-	do_autoload (final, cmd);
+	{
+	  /* do_autoload GCPROs both arguments */
+	  do_autoload (final, cmd);
+	}
       else
 	break;
     }
@@ -3212,6 +3216,7 @@
   return Qnil;
 }
 
+/* do_autoload GCPROs both arguments */
 void
 do_autoload (Lisp_Object fundef,
              Lisp_Object funname)
@@ -3219,10 +3224,10 @@
   /* This function can GC */
   int speccount = specpdl_depth();
   Lisp_Object fun = funname;
-  struct gcpro gcpro1, gcpro2;
+  struct gcpro gcpro1, gcpro2, gcpro3;
 
   CHECK_SYMBOL (funname);
-  GCPRO2 (fun, funname);
+  GCPRO3 (fundef, funname, fun);
 
   /* Value saved here is to be restored into Vautoload_queue */
   record_unwind_protect (un_autoload, Vautoload_queue);
@@ -3610,6 +3615,7 @@
 
       if (EQ (funcar, Qautoload))
 	{
+	  /* do_autoload GCPROs both arguments */
 	  do_autoload (fun, original_fun);
 	  goto retry;
 	}
@@ -3802,6 +3808,7 @@
 	}
       else if (EQ (funcar, Qautoload))
 	{
+	  /* do_autoload GCPROs both arguments */
 	  do_autoload (fun, args[0]);
 	  goto retry;
 	}
@@ -3892,11 +3899,8 @@
 	}
       else if (EQ (funcar, Qautoload))
 	{
-	  struct gcpro gcpro1;
-
-	  GCPRO1 (function);
+	  /* do_autoload GCPROs both arguments */
 	  do_autoload (function, orig_function);
-	  UNGCPRO;
 	  function = orig_function;
 	  goto retry;
 	}
--- a/src/keymap.c	Thu Aug 22 11:19:58 2002 +0000
+++ b/src/keymap.c	Thu Aug 22 11:31:43 2002 +0000
@@ -1042,10 +1042,8 @@
                && EQ (XCAR (tem), Qautoload)
                && EQ (Fcar (Fcdr (Fcdr (Fcdr (Fcdr (tem))))), Qkeymap))
 	{
-	  struct gcpro gcpro1, gcpro2;
-	  GCPRO2 (tem, object);
+	  /* do_autoload GCPROs both arguments */
 	  do_autoload (tem, object);
-	  UNGCPRO;
 	}
       else if (errorp)
 	object = wrong_type_argument (Qkeymapp, object);
--- a/src/lisp.h	Thu Aug 22 11:19:58 2002 +0000
+++ b/src/lisp.h	Thu Aug 22 11:31:43 2002 +0000
@@ -3980,7 +3980,7 @@
 int record_unwind_protect_freeing_dynarr (void *ptr);
 int internal_bind_int (int *addr, int newval);
 int internal_bind_lisp_object (Lisp_Object *addr, Lisp_Object newval);
-void do_autoload (Lisp_Object, Lisp_Object);
+void do_autoload (Lisp_Object, Lisp_Object); /* GCPROs both arguments */
 Lisp_Object un_autoload (Lisp_Object);
 void warn_when_safe_lispobj (Lisp_Object, Lisp_Object, Lisp_Object);
 void warn_when_safe (Lisp_Object, Lisp_Object, const CIbyte *,