qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 3/3] vhost-user-test: fix crash with glib < 2


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 3/3] vhost-user-test: fix crash with glib < 2.36
Date: Mon, 30 Nov 2015 17:40:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

"Michael S. Tsirkin" <address@hidden> writes:

> On Mon, Nov 30, 2015 at 12:17:00PM +0100, address@hidden wrote:
>> From: Marc-André Lureau <address@hidden>
>> 
>> The prepare callback needs to be implemented with glib < 2.36.
>> 
>> Signed-off-by: Marc-André Lureau <address@hidden>
>> ---
>>  tests/vhost-user-test.c | 17 +++++++++++++----
>>  1 file changed, 13 insertions(+), 4 deletions(-)
>> 
>> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
>> index 29205ed..27dedeb 100644
>> --- a/tests/vhost-user-test.c
>> +++ b/tests/vhost-user-test.c
>> @@ -506,11 +506,20 @@ test_migrate_source_check(GSource *source)
>>      return FALSE;
>>  }
>>  
>> +#if !GLIB_CHECK_VERSION(2,36,0)
>> +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)
>
> I don't see why do we need the ifdefs, we can use the
> same code for all versions.
> I queued a patch that does exactly that.

The ifdefs serve as a marker that lets us drop unnecessary code when our
required version of GLib reaches 2.36.  A comment might do, too, but it
should probably contain GLIB_CHECK_VERSION() to be visible in grep.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]