[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v10 03/13] qapi: Reposition error checks in gen_visi
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v10 03/13] qapi: Reposition error checks in gen_visit_fields() |
Date: |
Mon, 15 Feb 2016 17:20:47 -0700 |
Change the generated code for error checking after an optional
field visit to have one less level of indentation. There is no
real semantic change (the compiler should be smart enough to
realize that err does not change if visit_optional() returns
false, and optimize out unneeded branching in that case); the
main reason for the change is making the next patch (removing
a pointless goto) easier to read.
| if (visit_optional(v, "node-name", &has_node_name)) {
| visit_type_str(v, "node-name", (char **)&node_name, &err);
|- if (err) {
|- goto out_obj;
|- }
|+ }
|+ if (err) {
|+ goto out_obj;
| }
Signed-off-by: Eric Blake <address@hidden>
---
v10: new patch
---
scripts/qapi.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index f97236f..fab5001 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1673,13 +1673,14 @@ def gen_visit_fields(members, prefix='',
need_cast=False, skiperr=False,
c_type=memb.type.c_name(), prefix=prefix, cast=cast,
c_name=c_name(memb.name), name=memb.name,
errp=errparg)
- ret += gen_err_check(skiperr=skiperr, label=label)
if memb.optional:
pop_indent()
ret += mcgen('''
}
''')
+ ret += gen_err_check(skiperr=skiperr, label=label)
+
return ret
--
2.5.0
- [Qemu-devel] [PATCH v10 00/13] prune some QAPI visitor cruft (was qapi cleanups subset E), Eric Blake, 2016/02/15
- [Qemu-devel] [PATCH v10 04/13] qapi: Drop pointless gotos in generated code, Eric Blake, 2016/02/15
- [Qemu-devel] [PATCH v10 03/13] qapi: Reposition error checks in gen_visit_fields(),
Eric Blake <=
- [Qemu-devel] [PATCH v10 06/13] qapi-visit: Unify struct and union visit, Eric Blake, 2016/02/15
- [Qemu-devel] [PATCH v10 07/13] qapi-visit: Less indirection in visit_type_Foo_fields(), Eric Blake, 2016/02/15
- [Qemu-devel] [PATCH v10 05/13] qapi-visit: Simplify how we visit common union members, Eric Blake, 2016/02/15
- [Qemu-devel] [PATCH v10 01/13] qapi: Simplify excess input reporting in input visitors, Eric Blake, 2016/02/15
- [Qemu-devel] [PATCH v10 02/13] qapi: Forbid empty unions and useless alternates, Eric Blake, 2016/02/15
- [Qemu-devel] [PATCH v10 08/13] qapi: Adjust layout of FooList types, Eric Blake, 2016/02/15