From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz9W4-0001ZZ-G2 for qemu-devel@nongnu.org; Wed, 18 Nov 2015 15:39:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zz9W2-0005Sk-HT for qemu-devel@nongnu.org; Wed, 18 Nov 2015 15:39:44 -0500 Received: from mx2.suse.de ([195.135.220.15]:49499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz9W2-0005Sg-Aq for qemu-devel@nongnu.org; Wed, 18 Nov 2015 15:39:42 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 18 Nov 2015 21:39:32 +0100 Message-Id: <1447879178-5440-5-git-send-email-afaerber@suse.de> In-Reply-To: <1447879178-5440-1-git-send-email-afaerber@suse.de> References: <1447879178-5440-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 04/10] vl: Convert machine help code to use object property iterators List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: "Daniel P. Berrange" Stop directly accessing the Object::properties field data structure and instead use the formal object property iterator APIs. This insulates the code from future data structure changes in the Object struct. Signed-off-by: Daniel P. Berrange Tested-by: Pavel Fedin Signed-off-by: Andreas F=C3=A4rber --- vl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 7d993a5..4211ff1 100644 --- a/vl.c +++ b/vl.c @@ -1536,12 +1536,14 @@ MachineInfoList *qmp_query_machines(Error **errp) static int machine_help_func(QemuOpts *opts, MachineState *machine) { ObjectProperty *prop; + ObjectPropertyIterator *iter; =20 if (!qemu_opt_has_help_opt(opts)) { return 0; } =20 - QTAILQ_FOREACH(prop, &OBJECT(machine)->properties, node) { + iter =3D object_property_iter_init(OBJECT(machine)); + while ((prop =3D object_property_iter_next(iter))) { if (!prop->set) { continue; } @@ -1554,6 +1556,7 @@ static int machine_help_func(QemuOpts *opts, Machin= eState *machine) error_printf("\n"); } } + object_property_iter_free(iter); =20 return 1; } --=20 2.6.2