diff options
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/eval.c b/src/eval.c index 75874367f2c..26aea3df5df 100644 --- a/src/eval.c +++ b/src/eval.c @@ -38,9 +38,9 @@ struct backtrace struct backtrace *next; Lisp_Object *function; Lisp_Object *args; /* Points to vector of args. */ - int nargs; /* Length of vector. - If nargs is UNEVALLED, args points to slot holding - list of unevalled args. */ + size_t nargs; /* Length of vector. + If nargs is (size_t) UNEVALLED, args points + to slot holding list of unevalled args. */ char evalargs; /* Nonzero means call value of debugger when done with this operation. */ char debug_on_exit; @@ -111,7 +111,7 @@ Lisp_Object Vsignaling_function; int handling_signal; -static Lisp_Object funcall_lambda (Lisp_Object, int, Lisp_Object*); +static Lisp_Object funcall_lambda (Lisp_Object, size_t, Lisp_Object*); static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN; static int interactive_p (int); static Lisp_Object apply_lambda (Lisp_Object, Lisp_Object, int); @@ -553,7 +553,7 @@ interactive_p (int exclude_subrs_p) looking at several frames for special forms. Skip past them. */ while (btp && (EQ (*btp->function, Qbytecode) - || btp->nargs == UNEVALLED)) + || btp->nargs == (size_t) UNEVALLED)) btp = btp->next; /* `btp' now points at the frame of the innermost function that isn't @@ -959,7 +959,7 @@ usage: (let VARLIST BODY...) */) Lisp_Object *temps, tem; register Lisp_Object elt, varlist; int count = SPECPDL_INDEX (); - register int argnum; + register size_t argnum; struct gcpro gcpro1, gcpro2; USE_SAFE_ALLOCA; @@ -1508,8 +1508,8 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object), and ARGS as second argument. */ Lisp_Object -internal_condition_case_n (Lisp_Object (*bfun) (int, Lisp_Object*), - int nargs, +internal_condition_case_n (Lisp_Object (*bfun) (size_t, Lisp_Object *), + size_t nargs, Lisp_Object *args, Lisp_Object handlers, Lisp_Object (*hfun) (Lisp_Object)) @@ -2201,7 +2201,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, { /* Pass a vector of evaluated arguments. */ Lisp_Object *vals; - register int argnum = 0; + register size_t argnum = 0; USE_SAFE_ALLOCA; SAFE_ALLOCA_LISP (vals, XINT (numargs)); @@ -2330,9 +2330,9 @@ DEFUN ("apply", Fapply, Sapply, 2, MANY, 0, Then return the value FUNCTION returns. Thus, (apply '+ 1 2 '(3 4)) returns 10. usage: (apply FUNCTION &rest ARGUMENTS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { - register int i, numargs; + register size_t i, numargs; register Lisp_Object spread_arg; register Lisp_Object *funcall_args; Lisp_Object fun, retval; @@ -2372,7 +2372,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) if (numargs < XSUBR (fun)->min_args || (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args < numargs)) goto funcall; /* Let funcall get the error. */ - else if (XSUBR (fun)->max_args > numargs) + else if (XSUBR (fun)->max_args >= 0 && XSUBR (fun)->max_args > numargs) { /* Avoid making funcall cons up a yet another new vector of arguments by explicitly supplying nil's for optional values. */ @@ -2413,12 +2413,8 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) /* Run hook variables in various ways. */ -Lisp_Object run_hook_with_args (int, Lisp_Object *, - Lisp_Object (*funcall) - (int nargs, Lisp_Object *args)); - static Lisp_Object -funcall_nil (int nargs, Lisp_Object *args) +funcall_nil (size_t nargs, Lisp_Object *args) { Ffuncall (nargs, args); return Qnil; @@ -2439,10 +2435,10 @@ hook; they should use `run-mode-hooks' instead. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hooks &rest HOOKS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object hook[1]; - register int i; + register size_t i; for (i = 0; i < nargs; i++) { @@ -2468,7 +2464,7 @@ as that may change. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args HOOK &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return run_hook_with_args (nargs, args, funcall_nil); } @@ -2488,13 +2484,13 @@ However, if they all return nil, we return nil. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args-until-success HOOK &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return run_hook_with_args (nargs, args, Ffuncall); } static Lisp_Object -funcall_not (int nargs, Lisp_Object *args) +funcall_not (size_t nargs, Lisp_Object *args) { return NILP (Ffuncall (nargs, args)) ? Qt : Qnil; } @@ -2513,13 +2509,13 @@ Then we return nil. However, if they all return non-nil, we return non-nil. Do not use `make-local-variable' to make a hook variable buffer-local. Instead, use `add-hook' and specify t for the LOCAL argument. usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return NILP (run_hook_with_args (nargs, args, funcall_not)) ? Qt : Qnil; } static Lisp_Object -run_hook_wrapped_funcall (int nargs, Lisp_Object *args) +run_hook_wrapped_funcall (size_t nargs, Lisp_Object *args) { Lisp_Object tmp = args[0], ret; args[0] = args[1]; @@ -2537,11 +2533,11 @@ it calls WRAP-FUNCTION with arguments FUN and ARGS. As soon as a call to WRAP-FUNCTION returns non-nil, `run-hook-wrapped' aborts and returns that value. usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { return run_hook_with_args (nargs, args, run_hook_wrapped_funcall); } - + /* ARGS[0] should be a hook symbol. Call each of the functions in the hook value, passing each of them as arguments all the rest of ARGS (all NARGS - 1 elements). @@ -2550,8 +2546,8 @@ usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) */) except that it isn't necessary to gcpro ARGS[0]. */ Lisp_Object -run_hook_with_args (int nargs, Lisp_Object *args, - Lisp_Object (*funcall) (int nargs, Lisp_Object *args)) +run_hook_with_args (size_t nargs, Lisp_Object *args, + Lisp_Object (*funcall) (size_t nargs, Lisp_Object *args)) { Lisp_Object sym, val, ret = Qnil; struct gcpro gcpro1, gcpro2, gcpro3; @@ -2791,16 +2787,16 @@ DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0, Return the value that function returns. Thus, (funcall 'cons 'x 'y) returns (x . y). usage: (funcall FUNCTION &rest ARGUMENTS) */) - (int nargs, Lisp_Object *args) + (size_t nargs, Lisp_Object *args) { Lisp_Object fun, original_fun; Lisp_Object funcar; - int numargs = nargs - 1; + size_t numargs = nargs - 1; Lisp_Object lisp_numargs; Lisp_Object val; struct backtrace backtrace; register Lisp_Object *internal_args; - register int i; + register size_t i; QUIT; if ((consing_since_gc > gc_cons_threshold @@ -2953,21 +2949,21 @@ static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag) { Lisp_Object args_left; - Lisp_Object numargs; + size_t numargs; register Lisp_Object *arg_vector; struct gcpro gcpro1, gcpro2, gcpro3; - register int i; + register size_t i; register Lisp_Object tem; USE_SAFE_ALLOCA; - numargs = Flength (args); - SAFE_ALLOCA_LISP (arg_vector, XINT (numargs)); + numargs = XINT (Flength (args)); + SAFE_ALLOCA_LISP (arg_vector, numargs); args_left = args; GCPRO3 (*arg_vector, args_left, fun); gcpro1.nvars = 0; - for (i = 0; i < XINT (numargs);) + for (i = 0; i < numargs; ) { tem = Fcar (args_left), args_left = Fcdr (args_left); if (eval_flag) tem = Feval (tem); @@ -2983,7 +2979,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag) backtrace_list->nargs = i; } backtrace_list->evalargs = 0; - tem = funcall_lambda (fun, XINT (numargs), arg_vector); + tem = funcall_lambda (fun, numargs, arg_vector); /* Do the debug-on-exit now, while arg_vector still exists. */ if (backtrace_list->debug_on_exit) @@ -2999,11 +2995,13 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag) FUN must be either a lambda-expression or a compiled-code object. */ static Lisp_Object -funcall_lambda (Lisp_Object fun, int nargs, register Lisp_Object *arg_vector) +funcall_lambda (Lisp_Object fun, size_t nargs, + register Lisp_Object *arg_vector) { Lisp_Object val, syms_left, next; int count = SPECPDL_INDEX (); - int i, optional, rest; + size_t i; + int optional, rest; if (CONSP (fun)) { @@ -3323,7 +3321,6 @@ Output stream used is value of `standard-output'. */) (void) { register struct backtrace *backlist = backtrace_list; - register int i; Lisp_Object tail; Lisp_Object tem; struct gcpro gcpro1; @@ -3338,7 +3335,7 @@ Output stream used is value of `standard-output'. */) while (backlist) { write_string (backlist->debug_on_exit ? "* " : " ", 2); - if (backlist->nargs == UNEVALLED) + if (backlist->nargs == (size_t) UNEVALLED) { Fprin1 (Fcons (*backlist->function, *backlist->args), Qnil); write_string ("\n", -1); @@ -3348,11 +3345,12 @@ Output stream used is value of `standard-output'. */) tem = *backlist->function; Fprin1 (tem, Qnil); /* This can QUIT. */ write_string ("(", -1); - if (backlist->nargs == MANY) + if (backlist->nargs == (size_t) MANY) { + int i; for (tail = *backlist->args, i = 0; !NILP (tail); - tail = Fcdr (tail), i++) + tail = Fcdr (tail), i = 1) { if (i) write_string (" ", -1); Fprin1 (Fcar (tail), Qnil); @@ -3360,6 +3358,7 @@ Output stream used is value of `standard-output'. */) } else { + size_t i; for (i = 0; i < backlist->nargs; i++) { if (i) write_string (" ", -1); @@ -3389,7 +3388,7 @@ If NFRAMES is more than the number of frames, the value is nil. */) (Lisp_Object nframes) { register struct backtrace *backlist = backtrace_list; - register int i; + register EMACS_INT i; Lisp_Object tem; CHECK_NATNUM (nframes); @@ -3400,11 +3399,11 @@ If NFRAMES is more than the number of frames, the value is nil. */) if (!backlist) return Qnil; - if (backlist->nargs == UNEVALLED) + if (backlist->nargs == (size_t) UNEVALLED) return Fcons (Qnil, Fcons (*backlist->function, *backlist->args)); else { - if (backlist->nargs == MANY) + if (backlist->nargs == (size_t) MANY) tem = *backlist->args; else tem = Flist (backlist->nargs, backlist->args); @@ -3418,17 +3417,18 @@ void mark_backtrace (void) { register struct backtrace *backlist; - register int i; + register size_t i; for (backlist = backtrace_list; backlist; backlist = backlist->next) { mark_object (*backlist->function); - if (backlist->nargs == UNEVALLED || backlist->nargs == MANY) - i = 0; + if (backlist->nargs == (size_t) UNEVALLED + || backlist->nargs == (size_t) MANY) + i = 1; else - i = backlist->nargs - 1; - for (; i >= 0; i--) + i = backlist->nargs; + while (i--) mark_object (backlist->args[i]); } } |
