[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/20] qapi: Clean up shadowing of parameters and loc
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PULL 06/20] qapi: Clean up shadowing of parameters and locals in inner scopes |
Date: |
Fri, 16 May 2014 11:30:21 -0400 |
From: Markus Armbruster <address@hidden>
By un-inlining the visit of nested complex types.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
scripts/qapi-visit.py | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 28176ba..57be9bf 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -35,6 +35,19 @@ def generate_visit_struct_fields(name, field_prefix,
fn_prefix, members, base =
nested_field_prefix = "%s%s." % (field_prefix, argname)
ret += generate_visit_struct_fields(name, nested_field_prefix,
nested_fn_prefix, argentry)
+ ret += mcgen('''
+
+static void visit_type_%(full_name)s_field_%(c_name)s(Visitor *m, %(name)s
**obj, Error **errp)
+{
+ Error *err = NULL;
+''',
+ name=name, full_name=full_name, c_name=c_var(argname))
+ push_indent()
+ ret += generate_visit_struct_body(full_name, argname, argentry)
+ pop_indent()
+ ret += mcgen('''
+}
+''')
ret += mcgen('''
@@ -69,7 +82,10 @@ if ((*obj)->%(prefix)shas_%(c_name)s) {
push_indent()
if structured:
- ret += generate_visit_struct_body(full_name, argname, argentry)
+ ret += mcgen('''
+visit_type_%(full_name)s_field_%(c_name)s(m, obj, &err);
+''',
+ full_name=full_name, c_name=c_var(argname))
else:
ret += mcgen('''
visit_type_%(type)s(m, &(*obj)->%(c_prefix)s%(c_name)s, "%(name)s", &err);
@@ -106,8 +122,6 @@ if (!error_is_set(errp)) {
if len(field_prefix):
ret += mcgen('''
-Error **errp = &err; /* from outer scope */
-Error *err = NULL;
visit_start_struct(m, NULL, "", "%(name)s", 0, &err);
''',
name=name)
--
1.9.0
- [Qemu-devel] [PULL 14/20] monitor: Convert sendkey to use command_completion., (continued)
- [Qemu-devel] [PULL 14/20] monitor: Convert sendkey to use command_completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 13/20] qapi: Show qapi-commands.py invocation in qapi-code-gen.txt, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 20/20] qapi: skip redundant includes, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 11/20] tests: Don't call visit_end_struct() after visit_start_struct() fails, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 08/20] qapi: Un-inline visit of implicit struct, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 09/20] hmp: Call visit_end_struct() after visit_start_struct() succeeds, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 17/20] monitor: Add set_link arguments completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 16/20] monitor: Add chardev-add backend argument completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 15/20] monitor: Add chardev-remove command completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 19/20] monitor: Add netdev_del id argument completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 06/20] qapi: Clean up shadowing of parameters and locals in inner scopes,
Luiz Capitulino <=
- [Qemu-devel] [PULL 18/20] monitor: Add netdev_add type argument completion., Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 12/20] qapi: Replace uncommon use of the error API by the common one, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 03/20] qapi: Remove unused Visitor callbacks start_handle(), end_handle(), Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 05/20] qapi-visit.py: Clean up confusing push_indent() / pop_indent() use, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 10/20] hw: Don't call visit_end_struct() after visit_start_struct() fails, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 04/20] qapi: Replace start_optional()/end_optional() by optional(), Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 07/20] qapi-visit.py: Clean up a sloppy use of field prefix, Luiz Capitulino, 2014/05/16
- [Qemu-devel] [PULL 02/20] qapi: Normalize marshalling's visitor initialization and cleanup, Luiz Capitulino, 2014/05/16
- Re: [Qemu-devel] [PULL 00/20] QMP queue, Peter Maydell, 2014/05/19