From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39351) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SenAU-0007Qw-9d for qemu-devel@nongnu.org; Wed, 13 Jun 2012 08:59:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SenAI-0000LC-Ve for qemu-devel@nongnu.org; Wed, 13 Jun 2012 08:59:25 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48164 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SenAI-0000Ky-Os for qemu-devel@nongnu.org; Wed, 13 Jun 2012 08:59:14 -0400 Message-ID: <4FD88E95.8060806@suse.de> Date: Wed, 13 Jun 2012 14:59:01 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <76ad34dd30a83d96a97bc7443245ee9c165e053f.1339578989.git.peter.crosthwaite@petalogix.com> <4FD8658C.700@redhat.com> <4FD86B35.90000@suse.de> <4FD86EAA.1060005@redhat.com> In-Reply-To: <4FD86EAA.1060005@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC v0 5/8] object: make interfaces concrete List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Anthony Liguori Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, qemu-devel@nongnu.org, "Peter A. G. Crosthwaite" , paul@codesourcery.com, edgar.iglesias@gmail.com, john.williams@petalogix.com, avi@redhat.com Am 13.06.2012 12:42, schrieb Paolo Bonzini: > Il 13/06/2012 12:28, Andreas F=E4rber ha scritto: >> I am pretty certain that object_new() is NOT called recursively! >=20 > It is for interfaces: >=20 > object_new > ->object_new_with_type > ->object_initialize_with_type > ->object_init_with_type > ->object_interface_init >=20 > and then: >=20 > static void object_interface_init(Object *obj, InterfaceImpl *iface) > { > TypeImpl *ti =3D iface->type; > Interface *iface_obj; >=20 > assert(!object_is_interface(obj)); > iface_obj =3D INTERFACE(object_new(ti->name)); > iface_obj->iface_obj =3D obj; > iface_obj->iface_parent.interfaces =3D INTERFACE_MAGIC; >=20 > obj->interfaces =3D 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 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg