diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-02-18 23:42:46 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-02-18 23:42:46 +0000 |
commit | eeccdcb8291810cc8e5dc30a3a6bbb2ecf396a78 (patch) | |
tree | 55a3d290c742e8ab6a88e80a789807016ad7ba63 /gtk/gtktreeselection.c | |
parent | 1971cb493868a434368ad918246009f38ac81822 (diff) | |
download | gtk+-eeccdcb8291810cc8e5dc30a3a6bbb2ecf396a78.tar.gz |
Improve the efficiency here by prepending on the list and reverting it
Thu Feb 19 00:45:02 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtktreeselection.c (gtk_tree_selection_get_selected_rows):
Improve the efficiency here by prepending on the list and reverting
it after the loop. (#133435, Christian Biere)
Diffstat (limited to 'gtk/gtktreeselection.c')
-rw-r--r-- | gtk/gtktreeselection.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index 67c37ef359..94cd4b1d84 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -474,7 +474,7 @@ gtk_tree_selection_get_selected_rows (GtkTreeSelection *selection, do { if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED)) - list = g_list_append (list, gtk_tree_path_copy (path)); + list = g_list_prepend (list, gtk_tree_path_copy (path)); if (node->children) { @@ -506,7 +506,8 @@ gtk_tree_selection_get_selected_rows (GtkTreeSelection *selection, if (!tree) { gtk_tree_path_free (path); - return list; + + goto done; } gtk_tree_path_up (path); @@ -519,7 +520,8 @@ gtk_tree_selection_get_selected_rows (GtkTreeSelection *selection, gtk_tree_path_free (path); - return list; + done: + return g_list_reverse (list); } static void |