[gnome-settings-daemon] housekeeping: Do not use g_list_length



commit b0043816df2b78090a1c551d4ac3fa8317d5e9be
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Nov 15 08:49:56 2017 +0100

    housekeeping: Do not use g_list_length
    
    Do not use g_list_length when the number of elements can be easily
    counted in the previous for-cycle.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792235

 plugins/housekeeping/gsd-disk-space.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c
index e6eef0f..0ae4019 100644
--- a/plugins/housekeeping/gsd-disk-space.c
+++ b/plugins/housekeeping/gsd-disk-space.c
@@ -790,7 +790,7 @@ ldsm_check_all_mounts (gpointer data)
         GList *l;
         GList *check_mounts = NULL;
         GList *full_mounts = NULL;
-        guint number_of_mounts;
+        guint number_of_mounts = 0;
         gboolean multiple_volumes = FALSE;
 
         /* We iterate through the static mounts in /etc/fstab first, seeing if
@@ -844,11 +844,11 @@ ldsm_check_all_mounts (gpointer data)
                 }
 
                 check_mounts = g_list_prepend (check_mounts, mount_info);
+                number_of_mounts += 1;
         }
 
         g_list_free (mounts);
 
-        number_of_mounts = g_list_length (check_mounts);
         if (number_of_mounts > 1)
                 multiple_volumes = TRUE;
 


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