[glabels] Speed up large barcodes



commit 245b69b5ed745eea8509133fd5c49a8bdde8082f
Author: Christian Persch <chpe gnome org>
Date:   Sat Jun 5 17:35:10 2010 +0200

    Speed up large barcodes
    
    g_list_append() is evil. Just use prepend().

 src/bc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/bc.c b/src/bc.c
index f03b584..842879c 100644
--- a/src/bc.c
+++ b/src/bc.c
@@ -319,7 +319,7 @@ gl_barcode_add_shape (glBarcode      *bc,
 	g_return_if_fail (bc);
 	g_return_if_fail (shape);
 
-        bc->shapes = g_list_append (bc->shapes, shape);
+        bc->shapes = g_list_prepend (bc->shapes, shape);
 }
 
 
@@ -333,10 +333,10 @@ gl_barcode_get_styles_list  (void)
 	GList *list = NULL;
 
 	for (i=0; backends[i].id != NULL; i++) {
-		list = g_list_append (list, g_strdup (gettext (backends[i].name)));
+		list = g_list_prepend (list, g_strdup (gettext (backends[i].name)));
 	}
 
-	return list;
+	return g_list_reverse (list);
 }
 
 



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