[evolution-data-server] Simplify e_util_copy_object_slist().



commit 129a4d65f25e14fd53dc3c8e030290437e868826
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Jan 12 14:23:48 2013 -0500

    Simplify e_util_copy_object_slist().

 libedataserver/e-data-server-util.c |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/libedataserver/e-data-server-util.c b/libedataserver/e-data-server-util.c
index b17fdea..d326499 100644
--- a/libedataserver/e-data-server-util.c
+++ b/libedataserver/e-data-server-util.c
@@ -973,20 +973,12 @@ GSList *
 e_util_copy_object_slist (GSList *copy_to,
                           const GSList *objects)
 {
-	if (objects != NULL) {
-		const GSList *iter;
-		GSList *objects_copy = NULL;
-		/* Make deep copy of objects */
-		for (iter = objects; iter; iter = iter->next)
-			objects_copy = g_slist_prepend (
-				objects_copy, g_object_ref (iter->data));
-
-		/* Concatenate the two lists */
-		return g_slist_concat (
-			copy_to, g_slist_reverse (objects_copy));
-	}
+	GSList *copied_list;
 
-	return copy_to;
+	copied_list = g_slist_copy_deep (
+		(GSList *) copy_to, (GCopyFunc) g_object_ref, NULL);
+
+	return g_slist_concat (copy_to, copied_list);
 }
 
 /**



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