From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlyqC-0000Jj-Hr for qemu-devel@nongnu.org; Tue, 13 Oct 2015 08:38:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zlyq6-0004NF-Lh for qemu-devel@nongnu.org; Tue, 13 Oct 2015 08:38:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49371) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlyq6-0004M9-Hd for qemu-devel@nongnu.org; Tue, 13 Oct 2015 08:37:58 -0400 From: "Daniel P. Berrange" Date: Tue, 13 Oct 2015 13:37:42 +0100 Message-Id: <1444739866-14798-4-git-send-email-berrange@redhat.com> In-Reply-To: <1444739866-14798-1-git-send-email-berrange@redhat.com> References: <1444739866-14798-1-git-send-email-berrange@redhat.com> Subject: [Qemu-devel] [PATCH v4 3/7] 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: Pavel Fedin , Markus Armbruster , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= 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 --- vl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 7c806a2..81844ea 100644 --- a/vl.c +++ b/vl.c @@ -1514,12 +1514,14 @@ MachineInfoList *qmp_query_machines(Error **errp) static int machine_help_func(QemuOpts *opts, MachineState *machine) { ObjectProperty *prop; + ObjectPropertyIterator *iter; if (!qemu_opt_has_help_opt(opts)) { return 0; } - QTAILQ_FOREACH(prop, &OBJECT(machine)->properties, node) { + iter = object_property_iter_init(OBJECT(machine)); + while ((prop = object_property_iter_next(iter))) { if (!prop->set) { continue; } @@ -1532,6 +1534,7 @@ static int machine_help_func(QemuOpts *opts, MachineState *machine) error_printf("\n"); } } + object_property_iter_free(iter); return 1; } -- 2.4.3