diff options
| author | Chong Yidong | 2010-08-22 16:02:16 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-08-22 16:02:16 -0400 |
| commit | b0126eac41487b9bca5af5cbb2212ff5b2c58b80 (patch) | |
| tree | 680ba932d259776ebfdb6d424fa8f668e1001f7c /src/eval.c | |
| parent | b613941ba003bbf5024415ac4f8c2a0e12434751 (diff) | |
| parent | bc7d7ea63ba9d98b3ecc3b6decf4392a651dcbfb (diff) | |
| download | emacs-b0126eac41487b9bca5af5cbb2212ff5b2c58b80.tar.gz emacs-b0126eac41487b9bca5af5cbb2212ff5b2c58b80.zip | |
Merge changes from emacs-23 branch.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/eval.c b/src/eval.c index 5c6b268187b..89d353cf7cb 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -1011,12 +1011,13 @@ usage: (let VARLIST BODY...) */) | |||
| 1011 | int count = SPECPDL_INDEX (); | 1011 | int count = SPECPDL_INDEX (); |
| 1012 | register int argnum; | 1012 | register int argnum; |
| 1013 | struct gcpro gcpro1, gcpro2; | 1013 | struct gcpro gcpro1, gcpro2; |
| 1014 | USE_SAFE_ALLOCA; | ||
| 1014 | 1015 | ||
| 1015 | varlist = Fcar (args); | 1016 | varlist = Fcar (args); |
| 1016 | 1017 | ||
| 1017 | /* Make space to hold the values to give the bound variables */ | 1018 | /* Make space to hold the values to give the bound variables */ |
| 1018 | elt = Flength (varlist); | 1019 | elt = Flength (varlist); |
| 1019 | temps = (Lisp_Object *) alloca (XFASTINT (elt) * sizeof (Lisp_Object)); | 1020 | SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); |
| 1020 | 1021 | ||
| 1021 | /* Compute the values and store them in `temps' */ | 1022 | /* Compute the values and store them in `temps' */ |
| 1022 | 1023 | ||
| @@ -1049,6 +1050,7 @@ usage: (let VARLIST BODY...) */) | |||
| 1049 | } | 1050 | } |
| 1050 | 1051 | ||
| 1051 | elt = Fprogn (Fcdr (args)); | 1052 | elt = Fprogn (Fcdr (args)); |
| 1053 | SAFE_FREE (); | ||
| 1052 | return unbind_to (count, elt); | 1054 | return unbind_to (count, elt); |
| 1053 | } | 1055 | } |
| 1054 | 1056 | ||
| @@ -2301,8 +2303,9 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2301 | /* Pass a vector of evaluated arguments */ | 2303 | /* Pass a vector of evaluated arguments */ |
| 2302 | Lisp_Object *vals; | 2304 | Lisp_Object *vals; |
| 2303 | register int argnum = 0; | 2305 | register int argnum = 0; |
| 2306 | USE_SAFE_ALLOCA; | ||
| 2304 | 2307 | ||
| 2305 | vals = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); | 2308 | SAFE_ALLOCA_LISP (vals, XINT (numargs)); |
| 2306 | 2309 | ||
| 2307 | GCPRO3 (args_left, fun, fun); | 2310 | GCPRO3 (args_left, fun, fun); |
| 2308 | gcpro3.var = vals; | 2311 | gcpro3.var = vals; |
| @@ -2320,6 +2323,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2320 | 2323 | ||
| 2321 | val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); | 2324 | val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); |
| 2322 | UNGCPRO; | 2325 | UNGCPRO; |
| 2326 | SAFE_FREE (); | ||
| 2323 | goto done; | 2327 | goto done; |
| 2324 | } | 2328 | } |
| 2325 | 2329 | ||
| @@ -2430,8 +2434,9 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2430 | register int i, numargs; | 2434 | register int i, numargs; |
| 2431 | register Lisp_Object spread_arg; | 2435 | register Lisp_Object spread_arg; |
| 2432 | register Lisp_Object *funcall_args; | 2436 | register Lisp_Object *funcall_args; |
| 2433 | Lisp_Object fun; | 2437 | Lisp_Object fun, retval; |
| 2434 | struct gcpro gcpro1; | 2438 | struct gcpro gcpro1; |
| 2439 | USE_SAFE_ALLOCA; | ||
| 2435 | 2440 | ||
| 2436 | fun = args [0]; | 2441 | fun = args [0]; |
| 2437 | funcall_args = 0; | 2442 | funcall_args = 0; |
| @@ -2470,8 +2475,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2470 | { | 2475 | { |
| 2471 | /* Avoid making funcall cons up a yet another new vector of arguments | 2476 | /* Avoid making funcall cons up a yet another new vector of arguments |
| 2472 | by explicitly supplying nil's for optional values */ | 2477 | by explicitly supplying nil's for optional values */ |
| 2473 | funcall_args = (Lisp_Object *) alloca ((1 + XSUBR (fun)->max_args) | 2478 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); |
| 2474 | * sizeof (Lisp_Object)); | ||
| 2475 | for (i = numargs; i < XSUBR (fun)->max_args;) | 2479 | for (i = numargs; i < XSUBR (fun)->max_args;) |
| 2476 | funcall_args[++i] = Qnil; | 2480 | funcall_args[++i] = Qnil; |
| 2477 | GCPRO1 (*funcall_args); | 2481 | GCPRO1 (*funcall_args); |
| @@ -2483,8 +2487,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2483 | function itself as well as its arguments. */ | 2487 | function itself as well as its arguments. */ |
| 2484 | if (!funcall_args) | 2488 | if (!funcall_args) |
| 2485 | { | 2489 | { |
| 2486 | funcall_args = (Lisp_Object *) alloca ((1 + numargs) | 2490 | SAFE_ALLOCA_LISP (funcall_args, 1 + numargs); |
| 2487 | * sizeof (Lisp_Object)); | ||
| 2488 | GCPRO1 (*funcall_args); | 2491 | GCPRO1 (*funcall_args); |
| 2489 | gcpro1.nvars = 1 + numargs; | 2492 | gcpro1.nvars = 1 + numargs; |
| 2490 | } | 2493 | } |
| @@ -2500,7 +2503,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2500 | } | 2503 | } |
| 2501 | 2504 | ||
| 2502 | /* By convention, the caller needs to gcpro Ffuncall's args. */ | 2505 | /* By convention, the caller needs to gcpro Ffuncall's args. */ |
| 2503 | RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args)); | 2506 | retval = Ffuncall (gcpro1.nvars, funcall_args); |
| 2507 | UNGCPRO; | ||
| 2508 | SAFE_FREE (); | ||
| 2509 | |||
| 2510 | return retval; | ||
| 2504 | } | 2511 | } |
| 2505 | 2512 | ||
| 2506 | /* Run hook variables in various ways. */ | 2513 | /* Run hook variables in various ways. */ |
| @@ -3065,9 +3072,10 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag) | |||
| 3065 | struct gcpro gcpro1, gcpro2, gcpro3; | 3072 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 3066 | register int i; | 3073 | register int i; |
| 3067 | register Lisp_Object tem; | 3074 | register Lisp_Object tem; |
| 3075 | USE_SAFE_ALLOCA; | ||
| 3068 | 3076 | ||
| 3069 | numargs = Flength (args); | 3077 | numargs = Flength (args); |
| 3070 | arg_vector = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); | 3078 | SAFE_ALLOCA_LISP (arg_vector, XINT (numargs)); |
| 3071 | args_left = args; | 3079 | args_left = args; |
| 3072 | 3080 | ||
| 3073 | GCPRO3 (*arg_vector, args_left, fun); | 3081 | GCPRO3 (*arg_vector, args_left, fun); |
| @@ -3096,6 +3104,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag) | |||
| 3096 | tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); | 3104 | tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); |
| 3097 | /* Don't do it again when we return to eval. */ | 3105 | /* Don't do it again when we return to eval. */ |
| 3098 | backtrace_list->debug_on_exit = 0; | 3106 | backtrace_list->debug_on_exit = 0; |
| 3107 | SAFE_FREE (); | ||
| 3099 | return tem; | 3108 | return tem; |
| 3100 | } | 3109 | } |
| 3101 | 3110 | ||