qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC v0 5/8] object: make interfaces concrete


From: Andreas Färber
Subject: Re: [Qemu-devel] [RFC v0 5/8] object: make interfaces concrete
Date: Wed, 13 Jun 2012 14:59:01 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0

Am 13.06.2012 12:42, schrieb Paolo Bonzini:
> Il 13/06/2012 12:28, Andreas Färber ha scritto:
>> I am pretty certain that object_new() is NOT called recursively!
> 
> It is for interfaces:
> 
> object_new
>   ->object_new_with_type
>   ->object_initialize_with_type
>   ->object_init_with_type
>   ->object_interface_init
> 
> and then:
> 
> static void object_interface_init(Object *obj, InterfaceImpl *iface)
> {
>     TypeImpl *ti = iface->type;
>     Interface *iface_obj;
> 
>     assert(!object_is_interface(obj));
>     iface_obj = INTERFACE(object_new(ti->name));
>     iface_obj->iface_obj = obj;
>     iface_obj->iface_parent.interfaces = INTERFACE_MAGIC;
> 
>     obj->interfaces = g_slist_prepend(obj->interfaces, iface_obj);
> }

Ouch! One can argue that's still not recursive, but what matters more
this borks Anthony's in-place object_initialize() concept.

Two solutions come to mind:
* allocate the interfaces as part of object_new() beyond instance_size
* let initialize stage return Error*

I'm starting to tend towards the latter since that also addresses
failure to add properties.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

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