summaryrefslogtreecommitdiff
path: root/src/alloc.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/alloc.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/alloc.c')
-rw-r--r--src/alloc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 22a15b4ac59..2c7b02f1158 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3169,12 +3169,14 @@ allocate_pseudovector (int memlen, int lisplen,
struct Lisp_Vector *v = allocate_vectorlike (memlen);
/* Catch bogus values. */
- eassert (tag <= PVEC_FONT);
+ eassert (0 <= tag && tag <= PVEC_FONT);
+ eassert (0 <= lisplen && lisplen <= zerolen && zerolen <= memlen);
eassert (memlen - lisplen <= (1 << PSEUDOVECTOR_REST_BITS) - 1);
eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1);
- /* Only the first lisplen slots will be traced normally by the GC.
+ /* Only the first LISPLEN slots will be traced normally by the GC.
But since Qnil == 0, we can memset Lisp_Object slots as well. */
+ verify (NIL_IS_ZERO);
memset (v->contents, 0, zerolen * word_size);
XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen);