summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-01-19 00:56:18 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2015-01-19 01:01:58 -0800
commitb7f83adda5a32140811e8e7decc4394d64cada3d (patch)
tree98d7d6763a62fc033464e4f2d5edde5c937623dd /src/eval.c
parent9592a014df784e67a4647d5b6424f2758dfaad3c (diff)
downloademacs-b7f83adda5a32140811e8e7decc4394d64cada3d.tar.gz
Prefer memset to repeatedly assigning Qnil
* alloc.c (allocate_pseudovector): Catch more bogus values. * alloc.c (allocate_pseudovector): * callint.c (Fcall_interactively): * coding.c (syms_of_coding): * fringe.c (init_fringe): Verify that Qnil == 0. * callint.c (Fcall_interactively): * eval.c (Fapply, Ffuncall): * fns.c (mapcar1, larger_vector): * font.c (font_expand_wildcards): * fringe.c (init_fringe): Prefer memset to assigning zeros by hand. * callint.c (Fcall_interactively): Remove duplicate assignment of Qnil to args[i]. * coding.c (syms_of_coding): Prefer LISP_INITIALLY_ZERO to assigning zeros by hand. * fileio.c (Ffile_selinux_context): Rewrite to avoid need for Lisp_Object array. * lisp.h (XLI_BUILTIN_LISPSYM): New macro. (DEFINE_LISP_SYMBOL_END): Use it. (NIL_IS_ZERO): New constant. (memsetnil): New function.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c
index 5cadb1bc2de..ddf6535cabc 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2299,8 +2299,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. */
SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args);
- for (i = numargs; i < XSUBR (fun)->max_args; /* nothing */)
- funcall_args[++i] = Qnil;
+ memsetnil (funcall_args + numargs + 1, XSUBR (fun)->max_args - numargs);
funcall_nargs = 1 + XSUBR (fun)->max_args;
}
else
@@ -2638,8 +2637,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
ptrdiff_t numargs = nargs - 1;
Lisp_Object lisp_numargs;
Lisp_Object val;
- register Lisp_Object *internal_args;
- ptrdiff_t i, count;
+ Lisp_Object *internal_args;
+ ptrdiff_t count;
QUIT;
@@ -2694,8 +2693,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
eassert (XSUBR (fun)->max_args <= ARRAYELTS (internal_argbuf));
internal_args = internal_argbuf;
memcpy (internal_args, args + 1, numargs * word_size);
- for (i = numargs; i < XSUBR (fun)->max_args; i++)
- internal_args[i] = Qnil;
+ memsetnil (internal_args + numargs,
+ XSUBR (fun)->max_args - numargs);
}
else
internal_args = args + 1;