+2015-01-20 Paul Eggert <eggert@cs.ucla.edu>
+
+ Undo port to hypothetical nonzero Qnil case
+ This mostly undoes the previous change in this area. See:
+ http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00570.html
+ * alloc.c (allocate_pseudovector):
+ * callint.c (Fcall_interactively):
+ * dispnew.c (realloc_glyph_pool):
+ * fringe.c (init_fringe):
+ * lisp.h (memsetnil):
+ * xdisp.c (init_iterator):
+ Simplify by assuming that Qnil is zero, but verify the assumption.
+ * lisp.h (NIL_IS_ZERO): Revert back to this symbol, removing
+ NIL_IS_NONZERO. All uses changed.
+
2015-01-20 Jan Djärv <jan.h.d@swipnet.se>
* nsterm.m (EV_TRAILER2): Set Vinhibit_quit to Qt (Bug#19531).
eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1);
/* Only the first LISPLEN slots will be traced normally by the GC.
- If Qnil is nonzero, clear the non-Lisp data separately. */
+ Since Qnil == 0, we can memset Lisp and non-Lisp data at one go. */
+ verify (NIL_IS_ZERO);
memsetnil (v->contents, zerolen);
- if (NIL_IS_NONZERO)
- memset (v->contents + lisplen, 0, (zerolen - lisplen) * word_size);
XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen);
return v;
visargs = args + nargs;
varies = (signed char *) (visargs + nargs);
+ verify (NIL_IS_ZERO);
memset (args, 0, nargs * (2 * word_size + 1));
- if (NIL_IS_NONZERO)
- memsetnil (args, nargs * 2);
GCPRO5 (prefix_arg, function, *args, *visargs, up_event);
gcpro3.nvars = nargs;
ptrdiff_t old_nglyphs = pool->nglyphs;
pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs,
needed - old_nglyphs, -1, sizeof *pool->glyphs);
+
+ /* Redisplay relies on nil as the object of special glyphs
+ (truncation and continuation glyphs and also blanks used to
+ extend each line on a TTY), so verify that memset does this. */
+ verify (NIL_IS_ZERO);
+
memset (pool->glyphs + old_nglyphs, 0,
(pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs);
-
- /* Set the object of each glyph to nil. Redisplay relies on
- this for objects of special glyphs (truncation and continuation
- glyphs and also blanks used to extend each line on a TTY). */
- if (NIL_IS_NONZERO)
- for (ptrdiff_t i = old_nglyphs; i < pool->nglyphs; i++)
- pool->glyphs[i].object = Qnil;
}
/* Remember the number of rows and columns because (a) we use them
fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps);
+ verify (NIL_IS_ZERO);
fringe_faces = xzalloc (max_fringe_bitmaps * sizeof *fringe_faces);
- if (NIL_IS_NONZERO)
- memsetnil (fringe_faces, max_fringe_bitmaps);
}
#ifdef HAVE_NTGUI
XVECTOR (array)->contents[idx] = val;
}
-/* True if Qnil's representation is nonzero. This is always false currently,
- but there is fallback code for hypothetical alternative implementations.
- Compile with -DNIL_IS_NONZERO to test the fallback code. */
-#ifndef NIL_IS_NONZERO
-enum { NIL_IS_NONZERO = XLI_BUILTIN_LISPSYM (iQnil) != 0 };
-#endif
+/* True, since Qnil's representation is zero. Every place in the code
+ that assumes Qnil is zero should verify (NIL_IS_ZERO), to make it easy
+ to find such assumptions later if we change Qnil to be nonzero. */
+enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 };
/* Set a Lisp_Object array V's N entries to nil. */
INLINE void
memsetnil (Lisp_Object *v, ptrdiff_t n)
{
eassert (0 <= n);
+ verify (NIL_IS_ZERO);
memset (v, 0, n * sizeof *v);
- if (NIL_IS_NONZERO)
- for (ptrdiff_t i = 0; i < n; i++)
- v[i] = Qnil;
}
/* If a struct is made to look like a vector, this macro returns the length
}
/* Clear IT. */
+
+ /* The code assumes it->object and other Lisp_Object components are
+ set to nil, so verify that memset does this. */
+ verify (NIL_IS_ZERO);
memset (it, 0, sizeof *it);
- if (NIL_IS_NONZERO)
- {
- it->string = Qnil;
- it->from_overlay = Qnil;
- it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil;
- it->space_width = Qnil;
- it->font_height = Qnil;
- it->object = Qnil;
- it->bidi_it.string.lstring = Qnil;
- }
+
it->current.overlay_string_index = -1;
it->current.dpvec_index = -1;
it->base_face_id = remapped_base_face_id;