[gnome-settings-daemon] housekeeping: Fix incorrect handling of ignore_paths



commit 8ed86ae526dda44ed2c9f793facd5f5c70dc15ec
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Feb 21 00:03:27 2013 +0100

    housekeeping: Fix incorrect handling of ignore_paths
    
    You can't use G_N_ELEMENTS() on a non-static array.
    
    Also use a guint to iterate, and prepend to the list (which
    is quicker than appending for long lists).

 plugins/housekeeping/gsd-disk-space.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c
index b2976ea..704dd6c 100644
--- a/plugins/housekeeping/gsd-disk-space.c
+++ b/plugins/housekeeping/gsd-disk-space.c
@@ -965,12 +965,10 @@ gsd_ldsm_get_config (void)
 
         settings_list = g_settings_get_strv (settings, SETTINGS_IGNORE_PATHS);
         if (settings_list != NULL) {
-                gint i;
+                guint i;
 
-                for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
-                        if (settings_list[i] != NULL)
-                                ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i]));
-                }
+                for (i = 0; i < settings_list[i] != NULL; i++)
+                        ignore_paths = g_slist_prepend (ignore_paths, g_strdup (settings_list[i]));
 
                 /* Make sure we dont leave stale entries in ldsm_notified_hash */
                 g_hash_table_foreach_remove (ldsm_notified_hash,


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