[gtk/wip/chergert/avoid-renderop-copy: 1/2] gl: use memcmp to compare glyph cache keys
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/avoid-renderop-copy: 1/2] gl: use memcmp to compare glyph cache keys
- Date: Wed, 9 Oct 2019 22:42:38 +0000 (UTC)
commit b29feb193eac97c9cc31f33290bf3731757f4cb2
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 9 14:46:36 2019 -0700
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.
gsk/gl/gskglglyphcache.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
---
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 <graphene.h>
#include <cairo.h>
#include <epoxy/gl.h>
+#include <string.h>
/* 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]