]> code.delx.au - gnu-emacs/commitdiff
Verify that Qnil is zero before relying on that in redisplay.
authorEli Zaretskii <eliz@gnu.org>
Mon, 19 Jan 2015 17:22:17 +0000 (19:22 +0200)
committerEli Zaretskii <eliz@gnu.org>
Mon, 19 Jan 2015 17:22:17 +0000 (19:22 +0200)
 src/dispnew.c (adjust_glyph_matrix, realloc_glyph_pool): Verify that
 Qnil is represented as zero, before using that to initialize parts
 of the glyph structure.
 src/xdisp.c (init_iterator): Verify that Qnil is represented as
 zero, before using that to initialize parts of the iterator
 structure.

src/ChangeLog
src/dispnew.c
src/xdisp.c

index 04b952cae603619c49c524c2cd5f5972a6c3881c..f6a5f3837a39580492dd36550ffa02d2d48bbe79 100644 (file)
@@ -1,3 +1,13 @@
+2015-01-19  Eli Zaretskii  <eliz@gnu.org>
+
+       * dispnew.c (adjust_glyph_matrix, realloc_glyph_pool): Verify that
+       Qnil is represented as zero, before using that to initialize parts
+       of the glyph structure.
+
+       * xdisp.c (init_iterator): Verify that Qnil is represented as
+       zero, before using that to initialize parts of the iterator
+       structure.
+
 2015-01-19  Paul Eggert  <eggert@cs.ucla.edu>
 
        Prefer memset to repeatedly assigning Qnil
index a643d58e492aa0ad729c3c97403efb7045de9fb1..4aaf6db3a86d9269bbfa8086fb82fe9998ae4303 100644 (file)
@@ -413,6 +413,12 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
       new_rows = dim.height - matrix->rows_allocated;
       matrix->rows = xpalloc (matrix->rows, &matrix->rows_allocated,
                              new_rows, INT_MAX, sizeof *matrix->rows);
+      /* As a side effect, this sets the object of each glyph in the
+        row to nil, so verify we will indeed get that.  Redisplay
+        relies on the object of special glyphs (truncation and
+        continuation glyps and also blanks used to extend each line
+        on a TTY) to be nil.  */
+      verify (NIL_IS_ZERO);
       memset (matrix->rows + old_alloc, 0,
              (matrix->rows_allocated - old_alloc) * sizeof *matrix->rows);
     }
@@ -1339,6 +1345,12 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
       ptrdiff_t old_nglyphs = pool->nglyphs;
       pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs,
                              needed - old_nglyphs, -1, sizeof *pool->glyphs);
+      /* As a side effect, this sets the object of each glyph to nil,
+        so verify we will indeed get that.  Redisplay relies on the
+        object of special glyphs (truncation and continuation glyps
+        and also blanks used to extend each line on a TTY) to be
+        nil.  */
+      verify (NIL_IS_ZERO);
       memset (pool->glyphs + old_nglyphs, 0,
              (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs);
     }
index f006f8e0b94fe32b74c134f0385abc7a657cbd5d..2442367d3b51c6d9eb4a5e46f82589d0aaaa13e3 100644 (file)
@@ -2747,6 +2747,9 @@ init_iterator (struct it *it, struct window *w,
     }
 
   /* Clear IT.  */
+  /* As a side effect, this sets it->object to nil, so verify we will
+     indeed get that.  */
+  verify (NIL_IS_ZERO);
   memset (it, 0, sizeof *it);
   it->current.overlay_string_index = -1;
   it->current.dpvec_index = -1;