From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3kmH-0008G4-8S for qemu-devel@nongnu.org; Tue, 01 Dec 2015 08:15:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3kmD-00081N-0j for qemu-devel@nongnu.org; Tue, 01 Dec 2015 08:15:28 -0500 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:38551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3kmC-00081C-RR for qemu-devel@nongnu.org; Tue, 01 Dec 2015 08:15:24 -0500 Received: by wmec201 with SMTP id c201so12888102wme.1 for ; Tue, 01 Dec 2015 05:15:24 -0800 (PST) References: <1448901890-17012-1-git-send-email-marcandre.lureau@redhat.com> <1448901890-17012-4-git-send-email-marcandre.lureau@redhat.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1448901890-17012-4-git-send-email-marcandre.lureau@redhat.com> Date: Tue, 01 Dec 2015 13:15:20 +0000 Message-ID: <8737vmb993.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH for-2.5 v4 3/4] vhost-user-test: fix crash with glib < 2.36 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com Cc: qemu-devel@nongnu.org, mst@redhat.com marcandre.lureau@redhat.com writes: > From: Marc-André Lureau > > The prepare callback needs to be implemented with glib < 2.36, > quoting glib documentation: > "Since 2.36 this may be NULL, in which case the effect is as if the > function always returns FALSE with a timeout of -1." > > Signed-off-by: Marc-André Lureau Reviewed-by: Alex Bennée > --- > tests/vhost-user-test.c | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > > diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c > index 29205ed..29de739 100644 > --- a/tests/vhost-user-test.c > +++ b/tests/vhost-user-test.c > @@ -506,11 +506,22 @@ test_migrate_source_check(GSource *source) > return FALSE; > } > > +#if !GLIB_CHECK_VERSION(2,36,0) > +/* this callback is unnecessary with glib >2.36, the default > + * prepare for the source does the same */ > +static gboolean > +test_migrate_source_prepare(GSource *source, gint *timeout) > +{ > + *timeout = -1; > + return FALSE; > +} > +#endif > + > GSourceFuncs test_migrate_source_funcs = { > - NULL, > - test_migrate_source_check, > - NULL, > - NULL > +#if !GLIB_CHECK_VERSION(2,36,0) > + .prepare = test_migrate_source_prepare, > +#endif > + .check = test_migrate_source_check, > }; > > static void test_migrate(void) -- Alex Bennée