aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi/events.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/qapi/events.py')
-rw-r--r--scripts/qapi/events.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py
index b732581046..e0abfef7b0 100644
--- a/scripts/qapi/events.py
+++ b/scripts/qapi/events.py
@@ -65,6 +65,8 @@ def gen_event_send(name, arg_type, boxed, event_enum_name, event_emit):
# practice, we can rename our local variables with a leading _ prefix,
# or split the code into a wrapper function that creates a boxed
# 'param' object then calls another to do the real work.
+ have_args = boxed or (arg_type and not arg_type.is_empty())
+
ret = mcgen('''
%(proto)s
@@ -73,15 +75,13 @@ def gen_event_send(name, arg_type, boxed, event_enum_name, event_emit):
''',
proto=build_event_send_proto(name, arg_type, boxed))
- if arg_type and not arg_type.is_empty():
+ if have_args:
ret += mcgen('''
QObject *obj;
Visitor *v;
''')
if not boxed:
ret += gen_param_var(arg_type)
- else:
- assert not boxed
ret += mcgen('''
@@ -90,7 +90,7 @@ def gen_event_send(name, arg_type, boxed, event_enum_name, event_emit):
''',
name=name)
- if arg_type and not arg_type.is_empty():
+ if have_args:
ret += mcgen('''
v = qobject_output_visitor_new(&obj);
''')
@@ -121,7 +121,7 @@ def gen_event_send(name, arg_type, boxed, event_enum_name, event_emit):
event_emit=event_emit,
c_enum=c_enum_const(event_enum_name, name))
- if arg_type and not arg_type.is_empty():
+ if have_args:
ret += mcgen('''
visit_free(v);
''')