From: Daniel P. Berrange Date: Tue, 13 Oct 2015 12:37:42 +0000 (+0100) Subject: vl: Convert machine help code to use object property iterators X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=2465bc564d39d9b62fa21b3e84313be3b32dbc16;p=qemu.git vl: Convert machine help code to use object property iterators 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ärber --- diff --git a/vl.c b/vl.c index 7d993a5243..4211ff1ffd 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; 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; } @@ -1554,6 +1556,7 @@ static int machine_help_func(QemuOpts *opts, MachineState *machine) error_printf("\n"); } } + object_property_iter_free(iter); return 1; }