aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi-event.py
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2015-09-29 16:21:13 -0600
committerMarkus Armbruster <armbru@redhat.com>2015-10-12 18:46:50 +0200
commit1f35334489a43800df4d20cd91362a87cee39a29 (patch)
tree8cb5cea8f18e493525e5a8908e109b705b6b1d6e /scripts/qapi-event.py
parent05372f708a8cb3556e4d67458de79417dadf241f (diff)
downloadqemu-1f35334489a43800df4d20cd91362a87cee39a29.zip
qemu-1f35334489a43800df4d20cd91362a87cee39a29.tar.gz
qemu-1f35334489a43800df4d20cd91362a87cee39a29.tar.bz2
qapi: Share gen_err_check()
qapi-commands has a nice helper gen_err_check(), but did not use it everywhere. In fact, using it in more places makes it easier to reduce the lines of code used for generating error checks. This in turn will make it easier for later patches to consolidate another common pattern among the generators. The generated code has fewer blank lines in qapi-event.c functions, but has no semantic difference. Signed-off-by: Eric Blake <eblake@redhat.com> Message-Id: <1443565276-4535-16-git-send-email-eblake@redhat.com> [Drop another blank line for symmetry] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi-event.py')
-rw-r--r--scripts/qapi-event.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py
index b5a9d4f..eaaac05 100644
--- a/scripts/qapi-event.py
+++ b/scripts/qapi-event.py
@@ -68,12 +68,9 @@ def gen_event_send(name, arg_type):
/* Fake visit, as if all members are under a structure */
visit_start_struct(v, NULL, "", "%(name)s", 0, &err);
- if (err) {
- goto out;
- }
-
''',
name=name)
+ ret += gen_err_check()
for memb in arg_type.members:
if memb.optional:
@@ -91,14 +88,12 @@ def gen_event_send(name, arg_type):
ret += mcgen('''
visit_type_%(c_type)s(v, %(cast)s&%(c_name)s, "%(name)s", &err);
- if (err) {
- goto out;
- }
''',
cast=cast,
c_name=c_name(memb.name),
c_type=memb.type.c_name(),
name=memb.name)
+ ret += gen_err_check()
if memb.optional:
pop_indent()
@@ -107,7 +102,6 @@ def gen_event_send(name, arg_type):
''')
ret += mcgen('''
-
visit_end_struct(v, &err);
if (err) {
goto out;