aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert2015-01-19 16:49:11 -0800
committerPaul Eggert2015-01-19 17:17:30 -0800
commit347e01447194e511daaeee8835bcb86d2505e642 (patch)
treea075b2c51308d56221833b5e7d9e8e48e18e472d /src/lisp.h
parentfb6462f056f616f3da8ae18037c7c2137fecb6fd (diff)
downloademacs-347e01447194e511daaeee8835bcb86d2505e642.tar.gz
emacs-347e01447194e511daaeee8835bcb86d2505e642.zip
Port to hypothetical case where Qnil is nonzero
* alloc.c (allocate_pseudovector): * callint.c (Fcall_interactively): * coding.c (syms_of_coding): * dispnew.c (realloc_glyph_pool): * fringe.c (init_fringe): * lisp.h (memsetnil): * xdisp.c (init_iterator): Port to the currently-hypothetical case where Qnil is nonzero. * dispnew.c (adjust_glyph_matrix): Remove unnecessary verification, as there are no Lisp_Object values in the data here. * lisp.h (NIL_IS_NONZERO): New symbol, replacing NIL_IS_ZERO. All uses changed. Define only if not already defined, so that one can debug with -DNIL_IS_NONZERO. * xdisp.c (init_iterator): Remove unnecessary initializations to 0.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/lisp.h b/src/lisp.h
index a1ea35574c3..119257bc4b9 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1503,18 +1503,22 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
1503 XVECTOR (array)->contents[idx] = val; 1503 XVECTOR (array)->contents[idx] = val;
1504} 1504}
1505 1505
1506/* True, since Qnil's representation is zero. Every place in the code 1506/* True if Qnil's representation is nonzero. This is always false currently,
1507 that assumes Qnil is zero should verify (NIL_IS_ZERO), to make it easy 1507 but there is fallback code for hypothetical alternative implementations.
1508 to find such assumptions later if we change Qnil to be nonzero. */ 1508 Compile with -DNIL_IS_NONZERO to test the fallback code. */
1509enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 }; 1509#ifndef NIL_IS_NONZERO
1510enum { NIL_IS_NONZERO = XLI_BUILTIN_LISPSYM (iQnil) != 0 };
1511#endif
1510 1512
1511/* Set a Lisp_Object array V's SIZE entries to nil. */ 1513/* Set a Lisp_Object array V's N entries to nil. */
1512INLINE void 1514INLINE void
1513memsetnil (Lisp_Object *v, ptrdiff_t size) 1515memsetnil (Lisp_Object *v, ptrdiff_t n)
1514{ 1516{
1515 eassert (0 <= size); 1517 eassert (0 <= n);
1516 verify (NIL_IS_ZERO); 1518 memset (v, 0, n * sizeof *v);
1517 memset (v, 0, size * sizeof *v); 1519 if (NIL_IS_NONZERO)
1520 for (ptrdiff_t i = 0; i < n; i++)
1521 v[i] = Qnil;
1518} 1522}
1519 1523
1520/* If a struct is made to look like a vector, this macro returns the length 1524/* If a struct is made to look like a vector, this macro returns the length