From 39bd3b36bcd2896dd8ee41e2e0436583526ec83a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 26 Sep 2013 15:05:04 +0100 Subject: [PATCH 4/7] 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 --- docs/reference/telepathy-glib-sections.txt | 1 + telepathy-glib/util.c | 18 +++++++++++++++++- telepathy-glib/util.h | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index 9a0003b..0c5ea90 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -1754,6 +1754,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) * * * - * 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, -- 1.8.4.rc3