mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-08 22:45:43 +00:00
qapi: Drop qapi_event_send_FOO()'s Error ** argument
The generated qapi_event_send_FOO() take an Error ** argument. They can't actually fail, because all they do with the argument is passing it to functions that can't fail: the QObject output visitor, and the @qmp_emit callback, which is either monitor_qapi_event_queue() or event_test_emit(). Drop the argument, and pass &error_abort to the QObject output visitor and @qmp_emit instead. Backports commit 3ab72385b21d8d66df3f5fea42097ce264dc9d6b from qemu
This commit is contained in:
parent
4a8e094958
commit
9c05496958
|
@ -17,7 +17,7 @@ from qapi.common import *
|
|||
def build_event_send_proto(name, arg_type, boxed):
|
||||
return 'void qapi_event_send_%(c_name)s(%(param)s)' % {
|
||||
'c_name': c_name(name.lower()),
|
||||
'param': gen_params(arg_type, boxed, 'Error **errp')}
|
||||
'param': build_params(arg_type, boxed)}
|
||||
|
||||
|
||||
def gen_event_send_decl(name, arg_type, boxed):
|
||||
|
@ -69,7 +69,6 @@ def gen_event_send(name, arg_type, boxed, event_enum_name):
|
|||
%(proto)s
|
||||
{
|
||||
QDict *qmp;
|
||||
Error *err = NULL;
|
||||
QMPEventFuncEmit emit;
|
||||
''',
|
||||
proto=build_event_send_proto(name, arg_type, boxed))
|
||||
|
@ -103,45 +102,35 @@ def gen_event_send(name, arg_type, boxed, event_enum_name):
|
|||
''')
|
||||
if not arg_type.is_implicit():
|
||||
ret += mcgen('''
|
||||
visit_type_%(c_name)s(v, "%(name)s", &arg, &err);
|
||||
visit_type_%(c_name)s(v, "%(name)s", &arg, &error_abort);
|
||||
''',
|
||||
name=name, c_name=arg_type.c_name())
|
||||
else:
|
||||
ret += mcgen('''
|
||||
|
||||
visit_start_struct(v, "%(name)s", NULL, 0, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
visit_type_%(c_name)s_members(v, ¶m, &err);
|
||||
if (!err) {
|
||||
visit_check_struct(v, &err);
|
||||
}
|
||||
visit_start_struct(v, "%(name)s", NULL, 0, &error_abort);
|
||||
visit_type_%(c_name)s_members(v, ¶m, &error_abort);
|
||||
visit_check_struct(v, &error_abort);
|
||||
visit_end_struct(v, NULL);
|
||||
''',
|
||||
name=name, c_name=arg_type.c_name())
|
||||
ret += mcgen('''
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
visit_complete(v, &obj);
|
||||
qdict_put_obj(qmp, "data", obj);
|
||||
''')
|
||||
|
||||
ret += mcgen('''
|
||||
emit(%(c_enum)s, qmp, &err);
|
||||
emit(%(c_enum)s, qmp);
|
||||
|
||||
''',
|
||||
c_enum=c_enum_const(event_enum_name, name))
|
||||
|
||||
if arg_type and not arg_type.is_empty():
|
||||
ret += mcgen('''
|
||||
out:
|
||||
visit_free(v);
|
||||
''')
|
||||
ret += mcgen('''
|
||||
error_propagate(errp, err);
|
||||
qobject_unref(qmp);
|
||||
}
|
||||
''')
|
||||
|
|
Loading…
Reference in a new issue