[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r106358: Verify glyph row's hash valu
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r106358: Verify glyph row's hash values. |
Date: |
Sat, 12 Nov 2011 13:56:57 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 106358
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2011-11-12 13:56:57 +0200
message:
Verify glyph row's hash values.
src/dispnew.c (verify_row_hash) [XASSERTS]: New function.
(adjust_glyph_matrix, row_equal_p): Use it in xassert to verify
that the hash value of glyph rows is correct.
modified:
src/ChangeLog
src/dispnew.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2011-11-12 10:09:38 +0000
+++ b/src/ChangeLog 2011-11-12 11:56:57 +0000
@@ -2,6 +2,9 @@
* dispnew.c (scrolling_window): Fix incorrect indices in accessing
current_matrix and desired_matrix. (Bug#9990)
+ (verify_row_hash) [XASSERTS]: New function.
+ (adjust_glyph_matrix, row_equal_p): Use it in xassert to verify
+ that the hash value of glyph rows is correct.
2011-11-12 Martin Rudalics <address@hidden>
=== modified file 'src/dispnew.c'
--- a/src/dispnew.c 2011-11-12 10:09:38 +0000
+++ b/src/dispnew.c 2011-11-12 11:56:57 +0000
@@ -429,6 +429,25 @@
return n;
}
+#if XASSERTS
+/* Return non-zero if ROW's hash value is correct, zero if not. */
+int
+verify_row_hash (struct glyph_row *row)
+{
+ int area, k;
+ unsigned row_hash = 0;
+
+ for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
+ for (k = 0; k < row->used[area]; ++k)
+ row_hash = ((((row_hash << 4) + (row_hash >> 24)) & 0x0fffffff)
+ + row->glyphs[area][k].u.val
+ + row->glyphs[area][k].face_id
+ + row->glyphs[area][k].padding_p
+ + (row->glyphs[area][k].type << 2));
+
+ return row_hash == row->hash;
+}
+#endif
/* Adjust glyph matrix MATRIX on window W or on a frame to changed
window sizes.
@@ -600,6 +619,7 @@
row->glyphs[LAST_AREA]
= row->glyphs[LEFT_MARGIN_AREA] + dim.width;
}
+ xassert (!row->enabled_p || verify_row_hash (row));
++row;
}
}
@@ -1271,6 +1291,9 @@
static inline int
row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
{
+ xassert (verify_row_hash (a));
+ xassert (verify_row_hash (b));
+
if (a == b)
return 1;
else if (a->hash != b->hash)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r106358: Verify glyph row's hash values.,
Eli Zaretskii <=