From: Christian Hergert Date: Wed, 9 Oct 2019 21:46:36 +0000 (-0700) Subject: gl: use memcmp to compare glyph cache keys X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~753^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b29feb193eac97c9cc31f33290bf3731757f4cb2;p=gtk4.git gl: use memcmp to compare glyph cache keys We can just use memcmp here because even in the use of lookup keys with C99 initializers, we can rely on any space between fields added by the compiler to be zeroed. So we might as well use wider memory cmopares. --- diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c index 5e31369057..d1cf5b06f7 100644 --- a/gsk/gl/gskglglyphcache.c +++ b/gsk/gl/gskglglyphcache.c @@ -11,6 +11,7 @@ #include #include #include +#include /* Cache eviction strategy * @@ -78,14 +79,7 @@ gsk_gl_glyph_cache_unref (GskGLGlyphCache *self) static gboolean glyph_cache_equal (gconstpointer v1, gconstpointer v2) { - const GlyphCacheKey *key1 = v1; - const GlyphCacheKey *key2 = v2; - - return key1->font == key2->font && - key1->glyph == key2->glyph && - key1->xshift == key2->xshift && - key1->yshift == key2->yshift && - key1->scale == key2->scale; + return memcmp (v1, v2, sizeof (GlyphCacheKey)) == 0; } static guint