gl: Avoid pointless iteration
authorMatthias Clasen <mclasen@redhat.com>
Tue, 22 Oct 2019 06:28:33 +0000 (02:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 22 Oct 2019 11:16:41 +0000 (07:16 -0400)
gsk/gl/gskgldriver.c

index 02132fc463dd7f0e8fcfd9aebecf6921cc5d4e07..3eede927ba87688f7883d2f00cba1c90edb3a381 100644 (file)
@@ -554,21 +554,12 @@ gsk_gl_driver_get_texture_for_pointer (GskGLDriver *self,
 
   if (id != 0)
     {
-      GHashTableIter iter;
-      gpointer value_p;
-      /* Find the texture in self->textures and mark it used */
+      Texture *t;
 
-      g_hash_table_iter_init (&iter, self->textures);
-      while (g_hash_table_iter_next (&iter, NULL, &value_p))
-        {
-          Texture *t = value_p;
+      t = g_hash_table_lookup (self->textures, GINT_TO_POINTER (id));
 
-          if (t->texture_id == id)
-            {
-              t->in_use = TRUE;
-              break;
-            }
-        }
+      if (t != NULL)
+        t->in_use = TRUE;
     }
 
   return id;