aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-commands.py10
-rw-r--r--scripts/qapi-event.py8
2 files changed, 7 insertions, 11 deletions
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 49d4ce2590..34b6a3a07f 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -61,17 +61,13 @@ def gen_marshal_output(ret_type):
static void qmp_marshal_output_%(c_name)s(%(c_type)s ret_in, QObject **ret_out, Error **errp)
{
Error *err = NULL;
- QmpOutputVisitor *qov = qmp_output_visitor_new();
Visitor *v;
- v = qmp_output_get_visitor(qov);
+ v = qmp_output_visitor_new(ret_out);
visit_type_%(c_name)s(v, "unused", &ret_in, &err);
- if (err) {
- goto out;
+ if (!err) {
+ visit_complete(v, ret_out);
}
- *ret_out = qmp_output_get_qobject(qov);
-
-out:
error_propagate(errp, err);
visit_free(v);
v = qapi_dealloc_visitor_new();
diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py
index 909e8d6b8f..9c88627c9f 100644
--- a/scripts/qapi-event.py
+++ b/scripts/qapi-event.py
@@ -71,7 +71,7 @@ def gen_event_send(name, arg_type):
if arg_type and arg_type.members:
ret += mcgen('''
- QmpOutputVisitor *qov;
+ QObject *obj;
Visitor *v;
''')
ret += gen_param_var(arg_type)
@@ -90,8 +90,7 @@ def gen_event_send(name, arg_type):
if arg_type and arg_type.members:
ret += mcgen('''
- qov = qmp_output_visitor_new();
- v = qmp_output_get_visitor(qov);
+ v = qmp_output_visitor_new(&obj);
visit_start_struct(v, "%(name)s", NULL, 0, &err);
if (err) {
@@ -106,7 +105,8 @@ def gen_event_send(name, arg_type):
goto out;
}
- qdict_put_obj(qmp, "data", qmp_output_get_qobject(qov));
+ visit_complete(v, &obj);
+ qdict_put_obj(qmp, "data", obj);
''',
name=name, c_name=arg_type.c_name())