gnome-commander r2125 - in trunk: . src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r2125 - in trunk: . src
- Date: Fri, 26 Sep 2008 22:45:22 +0000 (UTC)
Author: epiotr
Date: Fri Sep 26 22:45:22 2008
New Revision: 2125
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2125&view=rev
Log:
Iterate through the file list MUCH faster (O(n*n) -> O(n))
Modified:
trunk/ChangeLog
trunk/src/gnome-cmd-delete-dialog.cc
Modified: trunk/src/gnome-cmd-delete-dialog.cc
==============================================================================
--- trunk/src/gnome-cmd-delete-dialog.cc (original)
+++ trunk/src/gnome-cmd-delete-dialog.cc Fri Sep 26 22:45:22 2008
@@ -159,21 +159,19 @@
static void perform_delete_operation (DeleteData *data)
{
GList *uri_list = NULL;
- gint num_files = g_list_length (data->files);
- // Go through all files and add the uri of the appropriate ones to a list
- for (gint i=0; i<num_files; i++)
+ // go through all files and add the uri of the appropriate ones to a list
+ for (GList *i=data->files; i; i=i->next)
{
- GnomeCmdFile *finfo = (GnomeCmdFile *) g_list_nth_data (data->files, i);
+ GnomeCmdFile *f = (GnomeCmdFile *) i->data;
- if (strcmp(finfo->info->name, "..") == 0 || strcmp(finfo->info->name, ".") == 0)
+ if (strcmp(f->info->name, "..") == 0 || strcmp(f->info->name, ".") == 0)
continue;
- GnomeVFSURI *uri = gnome_cmd_file_get_uri (finfo);
+ GnomeVFSURI *uri = gnome_cmd_file_get_uri (f);
if (!uri) continue;
- gnome_vfs_uri_ref (uri);
- uri_list = g_list_append (uri_list, uri);
+ uri_list = g_list_append (uri_list, gnome_vfs_uri_ref (uri));
}
if (uri_list)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]