[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 05/30] glib-compat: add g_test_add_data_func_
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 05/30] glib-compat: add g_test_add_data_func_full fallback |
Date: |
Tue, 21 Feb 2017 13:15:47 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 02/21/2017 08:14 AM, Marc-André Lureau wrote:
> Move the fallback from qtest_add_data_func_full() to glib-compat.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> include/glib-compat.h | 21 +++++++++++++++++++++
> tests/libqtest.c | 10 ----------
> 2 files changed, 21 insertions(+), 10 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
>
> diff --git a/include/glib-compat.h b/include/glib-compat.h
> index 0cd24ffbe9..863c8cf73d 100644
> --- a/include/glib-compat.h
> +++ b/include/glib-compat.h
> @@ -328,4 +328,25 @@ static inline void g_source_set_name_by_id(guint tag,
> const char *name)
> #define g_test_subprocess() (0)
> #endif
>
> +
> +#if !GLIB_CHECK_VERSION(2, 34, 0)
> +static inline void
> +g_test_add_data_func_full(const char *path,
> + gpointer data,
> + gpointer fn,
> + gpointer data_free_func)
> +{
> +#if GLIB_CHECK_VERSION(2, 26, 0)
> + /* back-compat casts, remove this once we can require new-enough glib */
> + g_test_add_vtable(path, 0, data, NULL,
> + (GTestFixtureFunc)fn, (GTestFixtureFunc)
> data_free_func);
> +#else
> + /* back-compat casts, remove this once we can require new-enough glib */
The comments are somewhat dead here, since they are guarded by
GLIB_CHECK_VERSION that states what the new-enough glib is (and the
older versions won't be changing).
> gchar *path = g_strdup_printf("/%s/%s", qtest_get_arch(), str);
> -#if GLIB_CHECK_VERSION(2, 34, 0)
> g_test_add_data_func_full(path, data, fn, data_free_func);
> -#elif GLIB_CHECK_VERSION(2, 26, 0)
> - /* back-compat casts, remove this once we can require new-enough glib */
> - g_test_add_vtable(path, 0, data, NULL,
> - (GTestFixtureFunc)fn, (GTestFixtureFunc)
> data_free_func);
> -#else
> - /* back-compat casts, remove this once we can require new-enough glib */
But since it is code motion, I don't care if you keep or remove the
comments.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 00/30] Various memory leak fixes, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 01/30] qtest: fix a memory leak, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 02/30] tests: fix qmp response leak, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 04/30] timer: use an inline function for free, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 03/30] tests: fix leaks in test-io-channel-command, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 05/30] glib-compat: add g_test_add_data_func_full fallback, Marc-André Lureau, 2017/02/21
- Re: [Qemu-devel] [PATCH v2 05/30] glib-compat: add g_test_add_data_func_full fallback,
Eric Blake <=
- [Qemu-devel] [PATCH v2 06/30] tests: fix ptimer leaks, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 08/30] tests: fix q35-test leaks, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 07/30] tests: fix endianness-test leaks, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 09/30] tests: fix vhost-user-test leaks, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 10/30] tests: fix ide-test leaks, Marc-André Lureau, 2017/02/21
- [Qemu-devel] [PATCH v2 11/30] tests: fix hd-geo-test leaks, Marc-André Lureau, 2017/02/21