[baobab] It turns out that clearing a list is this simple...



commit 325c309b1b8e6f70834699af288053beb0ddbd5b
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Jul 29 10:58:43 2012 +0200

    It turns out that clearing a list is this simple...
    
    Thanks to Jurg for pointing out I can just set the list to null

 src/baobab-location-list.vala |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
---
diff --git a/src/baobab-location-list.vala b/src/baobab-location-list.vala
index 5e760c2..598e41f 100644
--- a/src/baobab-location-list.vala
+++ b/src/baobab-location-list.vala
@@ -176,13 +176,7 @@ namespace Baobab {
             // FIXME: it would probably be cleaner to add the dir to the list of
             // locations ourselves, but for now we cheat and just rebuild the list
             // from scratch so that we get the proper ordering and deduplication
-            // FIXME: is this really how I clear a list in vala??
-            unowned List<Location> l = locations;
-            while (l != null) {
-                unowned List<Location> tmp = l.next;
-                locations.delete_link (l);
-                l = tmp;
-            }
+            locations = null;
             populate ();
         }
     }



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