From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkBtI-0005K1-OA for qemu-devel@nongnu.org; Thu, 08 Oct 2015 10:09:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkBtH-0006B1-QQ for qemu-devel@nongnu.org; Thu, 08 Oct 2015 10:09:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkBtH-0006Ao-Ls for qemu-devel@nongnu.org; Thu, 08 Oct 2015 10:09:51 -0400 From: "Daniel P. Berrange" Date: Thu, 8 Oct 2015 15:09:02 +0100 Message-Id: <1444313344-16196-4-git-send-email-berrange@redhat.com> In-Reply-To: <1444313344-16196-1-git-send-email-berrange@redhat.com> References: <1444313344-16196-1-git-send-email-berrange@redhat.com> Subject: [Qemu-devel] [PATCH v3 3/5] vl: convert machine help to use object_property_foreach List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Pavel Fedin , =?UTF-8?q?Andreas=20F=C3=A4rber?= Rather than directly traversing the object property list, use the object_property_foreach iterator. This removes a dependancy on the implementation approach for properties. Signed-off-by: Daniel P. Berrange --- vl.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/vl.c b/vl.c index f2bd8d2..a29fb82 100644 --- a/vl.c +++ b/vl.c @@ -1511,27 +1511,34 @@ MachineInfoList *qmp_query_machines(Error **errp) return mach_list; } -static int machine_help_func(QemuOpts *opts, MachineState *machine) + +static void machine_help_func_iter(Object *obj, + ObjectProperty *prop, + Error **errp, + void *opaque) { - ObjectProperty *prop; + MachineState *machine = MACHINE(obj); + if (!prop->set) { + return; + } + + error_printf("%s.%s=%s", MACHINE_GET_CLASS(machine)->name, + prop->name, prop->type); + if (prop->description) { + error_printf(" (%s)\n", prop->description); + } else { + error_printf("\n"); + } +} +static int machine_help_func(QemuOpts *opts, MachineState *machine) +{ if (!qemu_opt_has_help_opt(opts)) { return 0; } - QTAILQ_FOREACH(prop, &OBJECT(machine)->properties, node) { - if (!prop->set) { - continue; - } - - error_printf("%s.%s=%s", MACHINE_GET_CLASS(machine)->name, - prop->name, prop->type); - if (prop->description) { - error_printf(" (%s)\n", prop->description); - } else { - error_printf("\n"); - } - } + object_property_foreach(OBJECT(machine), + machine_help_func_iter, NULL, NULL); return 1; } -- 2.4.3