telepathy-glib: tp_value_array_free: add

Simon McVittie smcv at kemper.freedesktop.org
Thu Sep 26 08:33:02 PDT 2013


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

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu Sep 26 15:05:04 2013 +0100

tp_value_array_free: add

This lets connection managers and other Telepathy modules free the
result of tp_value_array_build() without deprecation warnings.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69849
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>

---

 docs/reference/telepathy-glib-sections.txt |    1 +
 telepathy-glib/util.c                      |   18 +++++++++++++++++-
 telepathy-glib/util.h                      |   17 +++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 5717105..d8f3a15 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -1755,6 +1755,7 @@ tp_g_key_file_get_uint64
 tp_g_signal_connect_object
 tp_value_array_build
 tp_value_array_unpack
+tp_value_array_free
 TpWeakRef
 tp_weak_ref_new
 tp_weak_ref_dup_object
diff --git a/telepathy-glib/util.c b/telepathy-glib/util.c
index e01dd22..7dca706 100644
--- a/telepathy-glib/util.c
+++ b/telepathy-glib/util.c
@@ -1097,7 +1097,7 @@ _tp_quark_array_copy (const GQuark *quarks)
  *    </programlisting>
  * </example>
  *
- * Returns: a newly created #GValueArray, free with g_value_array_free.
+ * Returns: a newly created #GValueArray, free with tp_value_array_free()
  *
  * Since: 0.9.2
  */
@@ -2118,3 +2118,19 @@ _tp_g_list_copy_deep (GList *list,
 
   return ret;
 }
+
+/**
+ * tp_value_array_free:
+ * @va: a #GValueArray
+ *
+ * Free @va. This is exactly the same as g_value_array_free(), but does not
+ * provoke deprecation warnings from GLib when used in conjunction with
+ * tp_value_array_build() and tp_value_array_unpack().
+ *
+ * Since: 0.UNRELEASED
+ */
+void
+(tp_value_array_free) (GValueArray *va)
+{
+  _tp_value_array_free_inline (va);
+}
diff --git a/telepathy-glib/util.h b/telepathy-glib/util.h
index 5c5b9a0..9492070 100644
--- a/telepathy-glib/util.h
+++ b/telepathy-glib/util.h
@@ -117,6 +117,23 @@ void tp_value_array_unpack (GValueArray *array,
     gsize len,
     ...);
 
+/* Work around GLib having deprecated something that is part of our API. */
+_TP_AVAILABLE_IN_UNRELEASED
+void tp_value_array_free (GValueArray *va);
+/* this is effectively _TP_AVAILABLE_IN_UNRELEASED too */
+#if TP_VERSION_MAX_ALLOWED >= _TP_VERSION_CUR_STABLE
+#define tp_value_array_free(va) _tp_value_array_free_inline (va)
+#ifndef __GTK_DOC_IGNORE__ /* gtk-doc can't parse this */
+static inline void
+_tp_value_array_free_inline (GValueArray *va)
+{
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+  g_value_array_free (va);
+  G_GNUC_END_IGNORE_DEPRECATIONS
+}
+#endif
+#endif
+
 /* See https://bugzilla.gnome.org/show_bug.cgi?id=680813 for glib inclusion */
 typedef struct _TpWeakRef TpWeakRef;
 TpWeakRef *tp_weak_ref_new (gpointer object,



More information about the telepathy-commits mailing list