[gtk/readonly-all-the-things: 3/4] gl: Avoid pointless iteration
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/readonly-all-the-things: 3/4] gl: Avoid pointless iteration
- Date: Tue, 22 Oct 2019 11:17:36 +0000 (UTC)
commit 472d8eebbe742c64587e36ec64ebe636d7ec6bf5
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Oct 22 02:28:33 2019 -0400
gl: Avoid pointless iteration
gsk/gl/gskgldriver.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c
index 02132fc463..3eede927ba 100644
--- a/gsk/gl/gskgldriver.c
+++ b/gsk/gl/gskgldriver.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]