From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQJs-0000sc-KK for qemu-devel@nongnu.org; Thu, 19 Nov 2015 09:36:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzQJn-00058N-1Z for qemu-devel@nongnu.org; Thu, 19 Nov 2015 09:36:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:42944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQJm-00058A-R1 for qemu-devel@nongnu.org; Thu, 19 Nov 2015 09:36:10 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 19 Nov 2015 15:36:02 +0100 Message-Id: <1447943768-31393-5-git-send-email-afaerber@suse.de> In-Reply-To: <1447943768-31393-1-git-send-email-afaerber@suse.de> References: <1447943768-31393-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 v2 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