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 <berra...@redhat.com> --- 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