[gtk] Window: Avoid some redundant assignments



commit 726909d735620d45f684b298c4af736b35c3e0db
Author: Timm Bäder <mail baedert org>
Date:   Thu Jan 2 13:52:14 2020 +0100

    Window: Avoid some redundant assignments

 gtk/gtkwindow.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 10dd3436bb..3901f2bb80 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1570,21 +1570,22 @@ device_removed_cb (GdkSeat   *seat,
 {
   GtkWindow *window = user_data;
   GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
-  GList *l = priv->foci, *cur;
+  GList *l = priv->foci;
 
   while (l)
     {
+      GList *next;
       GtkPointerFocus *focus = l->data;
 
-      cur = l;
-      focus = cur->data;
-      l = cur->next;
+      next = l->next;
 
       if (focus->device == device)
         {
-          priv->foci = g_list_delete_link (priv->foci, cur);
+          priv->foci = g_list_delete_link (priv->foci, l);
           gtk_pointer_focus_unref (focus);
         }
+
+      l = next;
     }
 }
 
@@ -9294,15 +9295,15 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
                                                  GtkWidget *widget)
 {
   GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
-  GList *l = priv->foci, *cur;
+  GList *l = priv->foci;
 
   while (l)
     {
+      GList *next;
+
       GtkPointerFocus *focus = l->data;
 
-      cur = l;
-      focus = cur->data;
-      l = cur->next;
+      next = l->next;
 
       gtk_pointer_focus_ref (focus);
 
@@ -9314,9 +9315,9 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
       if (GTK_WIDGET (focus->toplevel) == widget)
         {
           /* Unmapping the toplevel, remove pointer focus */
-          priv->foci = g_list_remove_link (priv->foci, cur);
+          priv->foci = g_list_remove_link (priv->foci, l);
           gtk_pointer_focus_unref (focus);
-          g_list_free (cur);
+          g_list_free (l);
         }
       else if (focus->target == widget ||
                gtk_widget_is_ancestor (focus->target, widget))
@@ -9325,6 +9326,8 @@ gtk_window_update_pointer_focus_on_state_change (GtkWindow *window,
         }
 
       gtk_pointer_focus_unref (focus);
+
+      l = next;
     }
 }
 
@@ -9334,15 +9337,13 @@ gtk_window_maybe_revoke_implicit_grab (GtkWindow *window,
                                        GtkWidget *grab_widget)
 {
   GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
-  GList *l = priv->foci, *cur;
+  GList *l = priv->foci;
 
   while (l)
     {
       GtkPointerFocus *focus = l->data;
 
-      cur = l;
-      focus = cur->data;
-      l = cur->next;
+      l = l->next;
 
       if (focus->toplevel != window)
         continue;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]