all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Protect arguments needed after eval_sub calls in Fdefvar and Fdefconst
@ 2014-11-20  2:31 Lee Duhem
  0 siblings, 0 replies; only message in thread
From: Lee Duhem @ 2014-11-20  2:31 UTC (permalink / raw
  To: emacs-devel; +Cc: Andreas Schwab, Stefan Monnier

Hi,

In the definitions of `Fdefvar' and `Fdefconst', the arguments and/or
some local variables
are needed after `eval_sub' calls, but are not protected by GCPRO,
this patch fix that.

Tested on my X86-64 box, it looks like I did not break anything. OK to commit?

Sincerely,
lee


* eval.c (Fdefvar, Fdefconst): Protect arguments needed after
`eval_sub' calls.
---
 src/ChangeLog | 4 ++++
 src/eval.c    | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index b169479..2cfed72 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-20  Lee Duhem  <lee.duhem@gmail.com>
+ * eval.c (Fdefvar, Fdefconst): Protect arguments needed after
+ `eval_sub' calls.
+
 2014-11-17  Paul Eggert  <eggert@cs.ucla.edu>

  Improve time stamp handling, and be more consistent about it.
diff --git a/src/eval.c b/src/eval.c
index 77b1db9..01a7eff 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -727,12 +727,15 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING)  */)
   (Lisp_Object args)
 {
   Lisp_Object sym, tem, tail;
+  struct gcpro gcpro1;

   sym = XCAR (args);
   tail = XCDR (args);

   if (CONSP (tail))
     {
+      GCPRO1(args);
+
       if (CONSP (XCDR (tail)) && CONSP (XCDR (XCDR (tail))))
  error ("Too many arguments");

@@ -761,6 +764,8 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING)  */)
   Fput (sym, Qvariable_documentation, tem);
  }
       LOADHIST_ATTACH (sym);
+
+      UNGCPRO;
     }
   else if (!NILP (Vinternal_interpreter_environment)
    && !XSYMBOL (sym)->declared_special)
@@ -798,11 +803,13 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING])  */)
   (Lisp_Object args)
 {
   Lisp_Object sym, tem;
+  struct gcpro gcpro1;

   sym = XCAR (args);
   if (CONSP (Fcdr (XCDR (XCDR (args)))))
     error ("Too many arguments");

+  GCPRO1(args);
   tem = eval_sub (Fcar (XCDR (args)));
   if (!NILP (Vpurify_flag))
     tem = Fpurecopy (tem);
@@ -817,6 +824,7 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING])  */)
     }
   Fput (sym, Qrisky_local_variable, Qt);
   LOADHIST_ATTACH (sym);
+  UNGCPRO;
   return sym;
 }

-- 
1.9.3



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-11-20  2:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20  2:31 [PATCH] Protect arguments needed after eval_sub calls in Fdefvar and Fdefconst Lee Duhem

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.