提交 468866b8 编写于 作者: M Markus Armbruster 提交者: Luiz Capitulino

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: NMarkus Armbruster <armbru@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 e2cd0f4f
......@@ -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);
}
}
''')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册