emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master fb6462f: Verify that Qnil is zero before relying on


From: Eli Zaretskii
Subject: [Emacs-diffs] master fb6462f: Verify that Qnil is zero before relying on that in redisplay.
Date: Mon, 19 Jan 2015 17:23:27 +0000

branch: master
commit fb6462f056f616f3da8ae18037c7c2137fecb6fd
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Verify that Qnil is zero before relying on that in redisplay.
    
     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 |   10 ++++++++++
 src/dispnew.c |   12 ++++++++++++
 src/xdisp.c   |    3 +++
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 04b952c..f6a5f38 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
+2015-01-19  Eli Zaretskii  <address@hidden>
+
+       * 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  <address@hidden>
 
        Prefer memset to repeatedly assigning Qnil
diff --git a/src/dispnew.c b/src/dispnew.c
index a643d58..4aaf6db 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -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);
     }
diff --git a/src/xdisp.c b/src/xdisp.c
index f006f8e..2442367 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]