qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at off


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 2/3] qobject: assume base of a qobject is at offset 0
Date: Wed, 21 Mar 2018 15:02:31 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 21/03/2018 15:01, Eric Blake wrote:
>>
> 
> Interesting.  If we do this, we should also simplify qobject_to() from
> its current:
> 
> #define qobject_to(type, obj) ({ \
>     QObject *_tmp = qobject_check_type(obj, glue(QTYPE_CAST_TO_, type)); \
>     _tmp ? container_of(_tmp, type, base) : (type *)NULL; })
> 
> to the simpler:
> 
> #define qobject_to(type, obj) \
>     ((type *)qobject_check_type(obj, glue(QTYPE_CAST_TO_, type)))

Yes, indeed!

Paolo



reply via email to

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