[xf86-video-intel,13/21] sna: Avoid strict aliasing violations with glyphinfo
diff mbox series

Message ID 20190919163113.17402-14-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • Compiler warn elimination
Related show

Commit Message

Ville Syrjala Sept. 19, 2019, 4:31 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Just access the xGlyphInfo members directly to avoid the
compiler getting upset about strict aliasing violations.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/sna_glyphs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index 6ee403360226..ebc061b5a8a8 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -85,8 +85,11 @@ 
 #define NO_ATLAS ((PicturePtr)-1)
 #define GLYPH_TOLERANCE 3
 
-#define glyph_valid(g) *((uint32_t *)&(g)->info.width)
-#define glyph_copy_size(r, g) *(uint32_t *)&(r)->width = *(uint32_t *)&g->info.width
+#define glyph_valid(g) ((g)->info.width || (g)->info.height)
+#define glyph_copy_size(r, g) do { \
+	(r)->width = (g)->info.width; \
+	(r)->height = (g)->info.height; \
+} while (0)
 
 #if HAS_PIXMAN_GLYPHS
 static  pixman_glyph_cache_t *__global_glyph_cache;