[Pkg-privacy-commits] [nautilus-wipe] 140/224: Prepend elements to lists rather than appending them

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Jul 7 19:45:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to branch master
in repository nautilus-wipe.

commit 46f31ebbd70f2c9be1105de44ee71c8372f2abc1
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Thu Aug 18 00:02:16 2011 +0200

    Prepend elements to lists rather than appending them
    
    This gives a little performance gain by not walking the list to find
    its end on each insertion. Instead, reverse the list when it is built.
---
 nautilus-wipe/fill-operation.c | 8 ++++----
 nautilus-wipe/nautilus-wipe.c  | 7 +++++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/nautilus-wipe/fill-operation.c b/nautilus-wipe/fill-operation.c
index 0b52737..7eee3cf 100644
--- a/nautilus-wipe/fill-operation.c
+++ b/nautilus-wipe/fill-operation.c
@@ -324,7 +324,7 @@ nautilus_wipe_fill_operation_filter_files (GList    *paths,
       } else {
         gchar *path;
         
-        work_mounts = g_list_append (work_mounts, mountpoint);
+        work_mounts = g_list_prepend (work_mounts, mountpoint);
         /* if it is not a directory, gets its container directory.
          * no harm since files cannot be mountpoint themselves, then it gets
          * at most the mountpoint itself */
@@ -333,19 +333,19 @@ nautilus_wipe_fill_operation_filter_files (GList    *paths,
         } else {
           path = g_strdup (file_path);
         }
-        work_paths = g_list_append (work_paths, path);
+        work_paths = g_list_prepend (work_paths, path);
       }
     }
   }
   if (err || ! work_paths_) {
     nautilus_wipe_path_list_free (work_paths);
   } else {
-    *work_paths_ = work_paths;
+    *work_paths_ = g_list_reverse (work_paths);
   }
   if (err || ! work_mounts_) {
     nautilus_wipe_path_list_free (work_mounts);
   } else {
-    *work_mounts_ = work_mounts;
+    *work_mounts_ = g_list_reverse (work_mounts);
   }
   if (err) {
     g_propagate_error (error, err);
diff --git a/nautilus-wipe/nautilus-wipe.c b/nautilus-wipe/nautilus-wipe.c
index 79d3f90..e7fd4b0 100644
--- a/nautilus-wipe/nautilus-wipe.c
+++ b/nautilus-wipe/nautilus-wipe.c
@@ -240,9 +240,10 @@ nautilus_wipe_path_list_copy (GList *src)
   GList *paths = NULL;
   
   while (src) {
-    paths = g_list_append (paths, g_strdup (src->data));
+    paths = g_list_prepend (paths, g_strdup (src->data));
     src = g_list_next (src);
   }
+  paths = g_list_reverse (paths);
   
   return paths;
 }
@@ -263,7 +264,7 @@ nautilus_wipe_nfi_list_to_path_list (GList *nfis)
     
     path = nautilus_wipe_nfi_get_path (nfis->data);
     if (path) {
-      paths = g_list_append (paths, path);
+      paths = g_list_prepend (paths, path);
     } else {
       success = FALSE;
     }
@@ -272,6 +273,8 @@ nautilus_wipe_nfi_list_to_path_list (GList *nfis)
   if (! success) {
     nautilus_wipe_path_list_free (paths);
     paths = NULL;
+  } else {
+    paths = g_list_reverse (paths);
   }
   
   return paths;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/nautilus-wipe.git



More information about the Pkg-privacy-commits mailing list