From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIePX-0003O4-MT for qemu-devel@nongnu.org; Mon, 11 Jan 2016 10:29:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIePU-0004kw-ES for qemu-devel@nongnu.org; Mon, 11 Jan 2016 10:29:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:48182) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIePT-0004kb-LX for qemu-devel@nongnu.org; Mon, 11 Jan 2016 10:29:32 -0500 References: <1449664442-26080-1-git-send-email-berrange@redhat.com> <877fkdzc89.fsf@blackfin.pond.sub.org> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Message-ID: <5693CA58.8080901@suse.de> Date: Mon, 11 Jan 2016 16:29:28 +0100 MIME-Version: 1.0 In-Reply-To: <877fkdzc89.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] qom: change object property iterator API contract List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , "Daniel P. Berrange" Cc: qemu-devel@nongnu.org Am 17.12.2015 um 09:54 schrieb Markus Armbruster: > "Daniel P. Berrange" writes: >=20 >> Currently the object property iterator API works as follows >> >> ObjectPropertyIterator *iter; >> >> iter =3D object_property_iter_init(obj); >> while ((prop =3D object_property_iter_next(iter))) { >> ... >> } >> object_property_iter_free(iter); >> >> This has the benefit that the ObjectPropertyIterator struct >> can be opaque, but has the downside that callers need to >> explicitly call a free function. It is also not in keeping >> with iterator style used elsewhere in QEMU/glib2 >> >> This patch changes the API to use stack allocation instead >> >> ObjectPropertyIterator iter; >> >> object_property_iter_init(&iter, obj); >> while ((prop =3D object_property_iter_next(&iter))) { >> ... >> } >> >> Reviewed-by: Eric Blake >> Signed-off-by: Daniel P. Berrange > [...] >> diff --git a/include/qom/object.h b/include/qom/object.h >> index 9630c5b..275a21b 100644 >> --- a/include/qom/object.h >> +++ b/include/qom/object.h >> @@ -971,6 +971,11 @@ ObjectProperty *object_class_property_find(Object= Class *klass, const char *name, >> =20 >> typedef struct ObjectPropertyIterator ObjectPropertyIterator; >> =20 >> +struct ObjectPropertyIterator { >> + ObjectClass *nextclass; >> + GHashTableIter iter; >> +}; >> + >=20 > Please fuse the two declarations. Perhaps Andreas can do that on > commit. Done. >> /** >> * object_property_iter_init: >> * @obj: the object >=20 > Reviewed-by: Markus Armbruster Queued on qom-next: https://github.com/afaerber/qemu-cpu/commits/qom-next Thanks, Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Felix Imend=F6rffer, Jane Smithard, Graham Norton; HRB 21284 (AG N=FC= rnberg)