[gimp] app: speed up GimpTagCache saving



commit 3c28ed4303da6adc4804237151d34bf94545c1c2
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 16 20:20:39 2011 +0200

    app: speed up GimpTagCache saving
    
    Use g_list_prepend() and g_list_reverse() instead of g_list_append().

 app/core/gimptagcache.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimptagcache.c b/app/core/gimptagcache.c
index d93b96f..87759ee 100644
--- a/app/core/gimptagcache.c
+++ b/app/core/gimptagcache.c
@@ -337,7 +337,7 @@ gimp_tag_cache_tagged_to_cache_record_foreach (GimpTagged  *tagged,
 
       g_free (checksum);
 
-      *cache_records = g_list_append (*cache_records, cache_rec);
+      *cache_records = g_list_prepend (*cache_records, cache_rec);
     }
 
   g_free (identifier);
@@ -378,7 +378,7 @@ gimp_tag_cache_save (GimpTagCache *cache)
           record_copy->checksum   = current_record->checksum;
           record_copy->tags       = g_list_copy (current_record->tags);
 
-          saved_records = g_list_append (saved_records, record_copy);
+          saved_records = g_list_prepend (saved_records, record_copy);
         }
     }
 
@@ -391,6 +391,8 @@ gimp_tag_cache_save (GimpTagCache *cache)
                               &saved_records);
     }
 
+  saved_records = g_list_reverse (saved_records);
+
   buf = g_string_new ("");
   g_string_append (buf, "<?xml version='1.0' encoding='UTF-8'?>\n");
   g_string_append (buf, "<tags>\n");



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