[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Protect arguments needed after eval_sub calls in Fdefvar and Fde
From: |
Lee Duhem |
Subject: |
[PATCH] Protect arguments needed after eval_sub calls in Fdefvar and Fdefconst |
Date: |
Thu, 20 Nov 2014 10:31:22 +0800 |
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 <address@hidden>
+ * eval.c (Fdefvar, Fdefconst): Protect arguments needed after
+ `eval_sub' calls.
+
2014-11-17 Paul Eggert <address@hidden>
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Protect arguments needed after eval_sub calls in Fdefvar and Fdefconst,
Lee Duhem <=