summaryrefslogtreecommitdiff
path: root/telepathy-glib/util.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-03-05 19:34:36 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-03-09 15:50:33 +0000
commitb455b394c152fbad69fcd743c2882469e2dec73f (patch)
tree343a98ff68a99ccb85f4c6c0c39a40479261c2e8 /telepathy-glib/util.c
parentbcbb0a54bb7090c12def75f3ba979c5537fa1f4f (diff)
downloadtelepathy-glib-b455b394c152fbad69fcd743c2882469e2dec73f.tar.gz
_tp_object_list_copy, _tp_object_list_free: add
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46358 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'telepathy-glib/util.c')
-rw-r--r--telepathy-glib/util.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/telepathy-glib/util.c b/telepathy-glib/util.c
index 7a46f50ff..a346d3404 100644
--- a/telepathy-glib/util.c
+++ b/telepathy-glib/util.c
@@ -2039,3 +2039,33 @@ _tp_contacts_from_values (GHashTable *table)
return contacts;
}
+
+/*
+ * @l: (transfer none) (element-type GLib.Object): a list of #GObject or
+ * any subclass
+ *
+ * Returns: (transfer full): a copy of @l
+ */
+GList *
+_tp_object_list_copy (GList *l)
+{
+ GList *new_l;
+
+ new_l = g_list_copy (l);
+ g_list_foreach (new_l, (GFunc) g_object_ref, NULL);
+ return new_l;
+}
+
+/*
+ * @l: (transfer full) (element-type GLib.Object): a list of #GObject or
+ * any subclass
+ *
+ * Unref each item of @l and free the list.
+ *
+ * This function can be cast to #GDestroyNotify.
+ */
+void
+_tp_object_list_free (GList *l)
+{
+ g_list_free_full (l, g_object_unref);
+}