summaryrefslogtreecommitdiffstats
path: root/scripts/qapi-visit.py
diff options
context:
space:
mode:
authorMichael Roth <mdroth@linux.vnet.ibm.com>2011-09-19 19:03:11 -0500
committerLuiz Capitulino <lcapitulino@redhat.com>2011-10-04 11:00:46 -0300
commite1bc2f7b3fb19ab2abcec3d5b15e045b00ae9da1 (patch)
tree737f967f3510569800635e938565b9501dcd3232 /scripts/qapi-visit.py
parent0b9d854230737b214c01e89f0b679ea36fd59e5e (diff)
downloadhqemu-e1bc2f7b3fb19ab2abcec3d5b15e045b00ae9da1.zip
hqemu-e1bc2f7b3fb19ab2abcec3d5b15e045b00ae9da1.tar.gz
qapi: modify visitor code generation for list iteration
Modify logic such that we never assign values to the list head argument to progress through the list on subsequent iterations, instead rely only on having our return value passed back in as an argument on the next call. Also update QMP I/O visitors and test cases accordingly, and add a missing test case for QmpOutputVisitor. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'scripts/qapi-visit.py')
-rw-r--r--scripts/qapi-visit.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 252230e..62de83d 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -79,11 +79,11 @@ def generate_visit_list(name, members):
void visit_type_%(name)sList(Visitor *m, %(name)sList ** obj, const char *name, Error **errp)
{
- GenericList *i;
+ GenericList *i, **head = (GenericList **)obj;
visit_start_list(m, name, errp);
- for (i = visit_next_list(m, (GenericList **)obj, errp); i; i = visit_next_list(m, &i, errp)) {
+ for (*head = i = visit_next_list(m, head, errp); i; i = visit_next_list(m, &i, errp)) {
%(name)sList *native_i = (%(name)sList *)i;
visit_type_%(name)s(m, &native_i->value, NULL, errp);
}
OpenPOWER on IntegriCloud