aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorStefan Monnier2010-09-13 16:40:48 +0200
committerStefan Monnier2010-09-13 16:40:48 +0200
commitcc390e46c7ba95b76ea133d98fd386214cd01709 (patch)
treeead4400d22bd07214b782ff7e46e79d473fac419 /src/eval.c
parentc566235d981eba73c88bbff00b6a1d88360b6e9f (diff)
parentc5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (diff)
downloademacs-cc390e46c7ba95b76ea133d98fd386214cd01709.tar.gz
emacs-cc390e46c7ba95b76ea133d98fd386214cd01709.zip
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...) */)
722 tail = XCDR (tail); 722 tail = XCDR (tail);
723 } 723 }
724 724
725 while (CONSP (Fcar (tail)) 725 if (CONSP (Fcar (tail))
726 && EQ (Fcar (Fcar (tail)), Qdeclare)) 726 && EQ (Fcar (Fcar (tail)), Qdeclare))
727 { 727 {
728 if (!NILP (Vmacro_declaration_function)) 728 if (!NILP (Vmacro_declaration_function))
729 { 729 {
@@ -1072,12 +1072,13 @@ usage: (let VARLIST BODY...) */)
1072 int count = SPECPDL_INDEX (); 1072 int count = SPECPDL_INDEX ();
1073 register int argnum; 1073 register int argnum;
1074 struct gcpro gcpro1, gcpro2; 1074 struct gcpro gcpro1, gcpro2;
1075 USE_SAFE_ALLOCA;
1075 1076
1076 varlist = Fcar (args); 1077 varlist = Fcar (args);
1077 1078
1078 /* Make space to hold the values to give the bound variables */ 1079 /* Make space to hold the values to give the bound variables */
1079 elt = Flength (varlist); 1080 elt = Flength (varlist);
1080 temps = (Lisp_Object *) alloca (XFASTINT (elt) * sizeof (Lisp_Object)); 1081 SAFE_ALLOCA_LISP (temps, XFASTINT (elt));
1081 1082
1082 /* Compute the values and store them in `temps' */ 1083 /* Compute the values and store them in `temps' */
1083 1084
@@ -1122,7 +1123,7 @@ usage: (let VARLIST BODY...) */)
1122 specbind (Qinternal_interpreter_environment, lexenv); 1123 specbind (Qinternal_interpreter_environment, lexenv);
1123 1124
1124 elt = Fprogn (Fcdr (args)); 1125 elt = Fprogn (Fcdr (args));
1125 1126 SAFE_FREE ();
1126 return unbind_to (count, elt); 1127 return unbind_to (count, elt);
1127} 1128}
1128 1129
@@ -2396,8 +2397,9 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2396 /* Pass a vector of evaluated arguments */ 2397 /* Pass a vector of evaluated arguments */
2397 Lisp_Object *vals; 2398 Lisp_Object *vals;
2398 register int argnum = 0; 2399 register int argnum = 0;
2400 USE_SAFE_ALLOCA;
2399 2401
2400 vals = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); 2402 SAFE_ALLOCA_LISP (vals, XINT (numargs));
2401 2403
2402 GCPRO3 (args_left, fun, fun); 2404 GCPRO3 (args_left, fun, fun);
2403 gcpro3.var = vals; 2405 gcpro3.var = vals;
@@ -2415,6 +2417,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2415 2417
2416 val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); 2418 val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals);
2417 UNGCPRO; 2419 UNGCPRO;
2420 SAFE_FREE ();
2418 goto done; 2421 goto done;
2419 } 2422 }
2420 2423
@@ -2536,8 +2539,9 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2536 register int i, numargs; 2539 register int i, numargs;
2537 register Lisp_Object spread_arg; 2540 register Lisp_Object spread_arg;
2538 register Lisp_Object *funcall_args; 2541 register Lisp_Object *funcall_args;
2539 Lisp_Object fun; 2542 Lisp_Object fun, retval;
2540 struct gcpro gcpro1; 2543 struct gcpro gcpro1;
2544 USE_SAFE_ALLOCA;
2541 2545
2542 fun = args [0]; 2546 fun = args [0];
2543 funcall_args = 0; 2547 funcall_args = 0;
@@ -2576,8 +2580,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2576 { 2580 {
2577 /* Avoid making funcall cons up a yet another new vector of arguments 2581 /* Avoid making funcall cons up a yet another new vector of arguments
2578 by explicitly supplying nil's for optional values */ 2582 by explicitly supplying nil's for optional values */
2579 funcall_args = (Lisp_Object *) alloca ((1 + XSUBR (fun)->max_args) 2583 SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args);
2580 * sizeof (Lisp_Object));
2581 for (i = numargs; i < XSUBR (fun)->max_args;) 2584 for (i = numargs; i < XSUBR (fun)->max_args;)
2582 funcall_args[++i] = Qnil; 2585 funcall_args[++i] = Qnil;
2583 GCPRO1 (*funcall_args); 2586 GCPRO1 (*funcall_args);
@@ -2589,8 +2592,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2589 function itself as well as its arguments. */ 2592 function itself as well as its arguments. */
2590 if (!funcall_args) 2593 if (!funcall_args)
2591 { 2594 {
2592 funcall_args = (Lisp_Object *) alloca ((1 + numargs) 2595 SAFE_ALLOCA_LISP (funcall_args, 1 + numargs);
2593 * sizeof (Lisp_Object));
2594 GCPRO1 (*funcall_args); 2596 GCPRO1 (*funcall_args);
2595 gcpro1.nvars = 1 + numargs; 2597 gcpro1.nvars = 1 + numargs;
2596 } 2598 }
@@ -2606,7 +2608,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2606 } 2608 }
2607 2609
2608 /* By convention, the caller needs to gcpro Ffuncall's args. */ 2610 /* By convention, the caller needs to gcpro Ffuncall's args. */
2609 RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args)); 2611 retval = Ffuncall (gcpro1.nvars, funcall_args);
2612 UNGCPRO;
2613 SAFE_FREE ();
2614
2615 return retval;
2610} 2616}
2611 2617
2612/* Run hook variables in various ways. */ 2618/* Run hook variables in various ways. */
@@ -3212,9 +3218,10 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag,
3212 struct gcpro gcpro1, gcpro2, gcpro3; 3218 struct gcpro gcpro1, gcpro2, gcpro3;
3213 register int i; 3219 register int i;
3214 register Lisp_Object tem; 3220 register Lisp_Object tem;
3221 USE_SAFE_ALLOCA;
3215 3222
3216 numargs = Flength (args); 3223 numargs = Flength (args);
3217 arg_vector = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); 3224 SAFE_ALLOCA_LISP (arg_vector, XINT (numargs));
3218 args_left = args; 3225 args_left = args;
3219 3226
3220 GCPRO3 (*arg_vector, args_left, fun); 3227 GCPRO3 (*arg_vector, args_left, fun);
@@ -3243,6 +3250,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag,
3243 tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); 3250 tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil)));
3244 /* Don't do it again when we return to eval. */ 3251 /* Don't do it again when we return to eval. */
3245 backtrace_list->debug_on_exit = 0; 3252 backtrace_list->debug_on_exit = 0;
3253 SAFE_FREE ();
3246 return tem; 3254 return tem;
3247} 3255}
3248 3256