qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 2/2] qom/object.c: Allow itf cast with num_it


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 2/2] qom/object.c: Allow itf cast with num_itfs = 0
Date: Tue, 19 Feb 2013 10:07:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

Il 19/02/2013 05:02, Peter Crosthwaite ha scritto:
> num_interfaces only tells you how many interfaces the concrete child class has
> (as defined in the TypeInfo). This means if you have a child class which 
> defines
> no interfaces of its own, but its parent has interfaces you cannot cast to 
> those
> parent interfaces.
> 
> Fixed changing the guard to check the class->interfaces list instead (which is
> a complete flattened list of implemented interfaces).
> 
> Signed-off-by: Peter Crosthwaite <address@hidden>
> ---
> changed from v1:
> Change guard implementation rather than removed it (Paolo review)
> 
>  qom/object.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/qom/object.c b/qom/object.c
> index 4b72a64..3d638ff 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -449,7 +449,8 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class,
>      TypeImpl *type = class->type;
>      ObjectClass *ret = NULL;
>  
> -    if (type->num_interfaces && type_is_ancestor(target_type, 
> type_interface)) {
> +    if (type->class->interfaces &&
> +            type_is_ancestor(target_type, type_interface)) {
>          int found = 0;
>          GSList *i;
>  
> 

Series looks good, thanks!

Paolo



reply via email to

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