[next] telepathy-glib: util: factor out tp_tests_dup_channel_props_asv()

Guillaume Desmottes gdesmott at kemper.freedesktop.org
Wed Jan 29 03:02:19 PST 2014


Module: telepathy-glib
Branch: next
Commit: e4ce8663faa4ecbc9a8d6b4431281d19d48b02da
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=e4ce8663faa4ecbc9a8d6b4431281d19d48b02da

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Thu Jan 16 12:25:46 2014 +0100

util: factor out tp_tests_dup_channel_props_asv()

---

 tests/lib/util.c |   30 ++++++++++++++++++++++--------
 tests/lib/util.h |    2 ++
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/tests/lib/util.c b/tests/lib/util.c
index 7e0aca6..2f902ea 100644
--- a/tests/lib/util.c
+++ b/tests/lib/util.c
@@ -681,21 +681,36 @@ tp_tests_channel_new_from_properties (TpConnection *conn,
       object_path, immutable_properties, error);
 }
 
+GHashTable *
+tp_tests_dup_channel_props_asv (TpChannel *channel)
+{
+  GVariant *variant;
+  GHashTable *asv;
+  GValue v = G_VALUE_INIT;
+
+  g_assert (channel != NULL);
+
+  variant = tp_channel_dup_immutable_properties (channel);
+  dbus_g_value_parse_g_variant (variant, &v);
+  asv = g_value_dup_boxed (&v);
+
+  g_variant_unref (variant);
+  g_value_unset (&v);
+
+  return asv;
+}
+
 void
 tp_tests_add_channel_to_ptr_array (GPtrArray *arr,
     TpChannel *channel)
 {
   GValueArray *tmp;
-  GVariant *variant;
-  GValue v = G_VALUE_INIT;
   GHashTable *asv;
 
   g_assert (arr != NULL);
   g_assert (channel != NULL);
 
-  variant = tp_channel_dup_immutable_properties (channel);
-  dbus_g_value_parse_g_variant (variant, &v);
-  asv = g_value_get_boxed (&v);
+  asv = tp_tests_dup_channel_props_asv (channel);
 
   tmp = tp_value_array_build (2,
       DBUS_TYPE_G_OBJECT_PATH, tp_proxy_get_object_path (channel),
@@ -703,7 +718,6 @@ tp_tests_add_channel_to_ptr_array (GPtrArray *arr,
       G_TYPE_INVALID);
 
   g_ptr_array_add (arr, tmp);
-  g_variant_unref (variant);
-  g_value_unset (&v);
-}
 
+  g_hash_table_unref (asv);
+}
diff --git a/tests/lib/util.h b/tests/lib/util.h
index 183e00f..05ded50 100644
--- a/tests/lib/util.h
+++ b/tests/lib/util.h
@@ -109,4 +109,6 @@ TpChannel *tp_tests_channel_new_from_properties (TpConnection *conn,
 void tp_tests_add_channel_to_ptr_array (GPtrArray *arr,
     TpChannel *channel);
 
+GHashTable * tp_tests_dup_channel_props_asv (TpChannel *channel);
+
 #endif /* #ifndef __TP_TESTS_LIB_UTIL_H__ */



More information about the telepathy-commits mailing list