summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2010-09-13 16:40:48 +0200
committerStefan Monnier <monnier@iro.umontreal.ca>2010-09-13 16:40:48 +0200
commitcc390e46c7ba95b76ea133d98fd386214cd01709 (patch)
treeead4400d22bd07214b782ff7e46e79d473fac419 /src/eval.c
parentc566235d981eba73c88bbff00b6a1d88360b6e9f (diff)
parentc5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (diff)
downloademacs-cc390e46c7ba95b76ea133d98fd386214cd01709.tar.gz
Merge from trunk
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/eval.c b/src/eval.c
index 6d0a49c0d7e..a16d6c59809 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -722,8 +722,8 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */)
tail = XCDR (tail);
}
- while (CONSP (Fcar (tail))
- && EQ (Fcar (Fcar (tail)), Qdeclare))
+ if (CONSP (Fcar (tail))
+ && EQ (Fcar (Fcar (tail)), Qdeclare))
{
if (!NILP (Vmacro_declaration_function))
{
@@ -1072,12 +1072,13 @@ usage: (let VARLIST BODY...) */)
int count = SPECPDL_INDEX ();
register int argnum;
struct gcpro gcpro1, gcpro2;
+ USE_SAFE_ALLOCA;
varlist = Fcar (args);
/* Make space to hold the values to give the bound variables */
elt = Flength (varlist);
- temps = (Lisp_Object *) alloca (XFASTINT (elt) * sizeof (Lisp_Object));
+ SAFE_ALLOCA_LISP (temps, XFASTINT (elt));
/* Compute the values and store them in `temps' */
@@ -1122,7 +1123,7 @@ usage: (let VARLIST BODY...) */)
specbind (Qinternal_interpreter_environment, lexenv);
elt = Fprogn (Fcdr (args));
-
+ SAFE_FREE ();
return unbind_to (count, elt);
}
@@ -2396,8 +2397,9 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
/* Pass a vector of evaluated arguments */
Lisp_Object *vals;
register int argnum = 0;
+ USE_SAFE_ALLOCA;
- vals = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object));
+ SAFE_ALLOCA_LISP (vals, XINT (numargs));
GCPRO3 (args_left, fun, fun);
gcpro3.var = vals;
@@ -2415,6 +2417,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals);
UNGCPRO;
+ SAFE_FREE ();
goto done;
}
@@ -2536,8 +2539,9 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
register int i, numargs;
register Lisp_Object spread_arg;
register Lisp_Object *funcall_args;
- Lisp_Object fun;
+ Lisp_Object fun, retval;
struct gcpro gcpro1;
+ USE_SAFE_ALLOCA;
fun = args [0];
funcall_args = 0;
@@ -2576,8 +2580,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
{
/* Avoid making funcall cons up a yet another new vector of arguments
by explicitly supplying nil's for optional values */
- funcall_args = (Lisp_Object *) alloca ((1 + XSUBR (fun)->max_args)
- * sizeof (Lisp_Object));
+ SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args);
for (i = numargs; i < XSUBR (fun)->max_args;)
funcall_args[++i] = Qnil;
GCPRO1 (*funcall_args);
@@ -2589,8 +2592,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
function itself as well as its arguments. */
if (!funcall_args)
{
- funcall_args = (Lisp_Object *) alloca ((1 + numargs)
- * sizeof (Lisp_Object));
+ SAFE_ALLOCA_LISP (funcall_args, 1 + numargs);
GCPRO1 (*funcall_args);
gcpro1.nvars = 1 + numargs;
}
@@ -2606,7 +2608,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
}
/* By convention, the caller needs to gcpro Ffuncall's args. */
- RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args));
+ retval = Ffuncall (gcpro1.nvars, funcall_args);
+ UNGCPRO;
+ SAFE_FREE ();
+
+ return retval;
}
/* Run hook variables in various ways. */
@@ -3212,9 +3218,10 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag,
struct gcpro gcpro1, gcpro2, gcpro3;
register int i;
register Lisp_Object tem;
+ USE_SAFE_ALLOCA;
numargs = Flength (args);
- arg_vector = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object));
+ SAFE_ALLOCA_LISP (arg_vector, XINT (numargs));
args_left = args;
GCPRO3 (*arg_vector, args_left, fun);
@@ -3243,6 +3250,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag,
tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil)));
/* Don't do it again when we return to eval. */
backtrace_list->debug_on_exit = 0;
+ SAFE_FREE ();
return tem;
}