aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-05-07 09:53:47 +0200
committerLuiz Capitulino <lcapitulino@redhat.com>2014-05-15 14:00:45 -0400
commit468866b816f13c8141b692ac0280706c16b30185 (patch)
treeabfe5b94c75a0f2c6d6b4978662c6477871df6a6 /scripts
parente2cd0f4fb42b1fae65ad22e8efde9804446e6254 (diff)
downloadqemu-468866b816f13c8141b692ac0280706c16b30185.zip
qemu-468866b816f13c8141b692ac0280706c16b30185.tar.gz
qemu-468866b816f13c8141b692ac0280706c16b30185.tar.bz2
qapi-visit.py: Clean up confusing push_indent() / pop_indent() use
Changing implicit indentation in the middle of generating a block makes following the code being generated unnecessarily hard. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-visit.py32
1 files changed, 14 insertions, 18 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 9f22eee..28176ba 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -128,12 +128,14 @@ if (!err) {
''',
name=full_name)
+ ret += mcgen('''
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+}
+error_propagate(errp, err);
+''')
pop_indent()
ret += mcgen('''
- /* Always call end_struct if start_struct succeeded. */
- visit_end_struct(m, &err);
- }
- error_propagate(errp, err);
}
''')
return ret
@@ -289,19 +291,15 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **
''',
name=name)
-
- push_indent()
push_indent()
push_indent()
if base:
ret += mcgen('''
- visit_type_%(name)s_fields(m, obj, &err);
+ visit_type_%(name)s_fields(m, obj, &err);
''',
name=name)
- pop_indent()
-
if not discriminator:
disc_key = "type"
else:
@@ -343,19 +341,17 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **
}
error_propagate(errp, err);
err = NULL;
- }
''')
pop_indent()
- ret += mcgen('''
- /* Always call end_struct if start_struct succeeded. */
- visit_end_struct(m, &err);
- }
- error_propagate(errp, err);
-}
-''')
+ pop_indent()
- pop_indent();
ret += mcgen('''
+ }
+ /* Always call end_struct if start_struct succeeded. */
+ visit_end_struct(m, &err);
+ }
+ error_propagate(errp, err);
+ }
}
''')