Mercurial > emacs
diff src/eval.c @ 109954:53205019b195
Merge changes from emacs-23 branch.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 22 Aug 2010 16:02:16 -0400 |
parents | b668431e0039 7daea44c7bcc |
children | f7b98576d87f |
line wrap: on
line diff
--- a/src/eval.c Sun Aug 22 20:20:55 2010 +0300 +++ b/src/eval.c Sun Aug 22 16:02:16 2010 -0400 @@ -1011,12 +1011,13 @@ 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' */ @@ -1049,6 +1050,7 @@ } elt = Fprogn (Fcdr (args)); + SAFE_FREE (); return unbind_to (count, elt); } @@ -2301,8 +2303,9 @@ /* Pass a vector of evaluated arguments */ Lisp_Object *vals; register int argnum = 0; - - vals = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); + USE_SAFE_ALLOCA; + + SAFE_ALLOCA_LISP (vals, XINT (numargs)); GCPRO3 (args_left, fun, fun); gcpro3.var = vals; @@ -2320,6 +2323,7 @@ val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); UNGCPRO; + SAFE_FREE (); goto done; } @@ -2430,8 +2434,9 @@ 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; @@ -2470,8 +2475,7 @@ { /* 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); @@ -2483,8 +2487,7 @@ 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; } @@ -2500,7 +2503,11 @@ } /* 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. */ @@ -3065,9 +3072,10 @@ 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); @@ -3096,6 +3104,7 @@ 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; }