[mutter] workspace: Make the code for removing windows easier to read



commit 5f7c9017277bb5c2e0ace30e1c8c284765e7a600
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Aug 15 23:01:11 2014 -0400

    workspace: Make the code for removing windows easier to read
    
    Repeatedly pop off the head of the list rather than iterating through
    it.

 src/core/workspace.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
---
diff --git a/src/core/workspace.c b/src/core/workspace.c
index bc718da..f9b0a62 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -246,7 +246,6 @@ workspace_free_builtin_struts (MetaWorkspace *workspace)
 void
 meta_workspace_remove (MetaWorkspace *workspace)
 {
-  GList *tmp;
   MetaScreen *screen;
   int i;
 
@@ -256,18 +255,13 @@ meta_workspace_remove (MetaWorkspace *workspace)
    * as well, so they won't be "orphaned"
    */
 
-  tmp = workspace->windows;
-  while (tmp != NULL)
+  while (workspace->windows != NULL)
     {
-      GList *next;
-      MetaWindow *window = tmp->data;
-      next = tmp->next;
+      MetaWindow *window = workspace->windows->data;
 
       /* pop front of list we're iterating over */
       meta_workspace_remove_window (workspace, window);
       g_assert (window->workspace != NULL);
-
-      tmp = next;
     }
 
   g_assert (workspace->windows == NULL);


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