qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL v2 04/10] vl: Convert machine help code to use object


From: Andreas Färber
Subject: [Qemu-devel] [PULL v2 04/10] vl: Convert machine help code to use object property iterators
Date: Thu, 19 Nov 2015 15:36:02 +0100

From: "Daniel P. Berrange" <address@hidden>

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 <address@hidden>
Tested-by: Pavel Fedin <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
 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;
 
     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;
 }
-- 
2.6.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]