mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
qmp: De-duplicate error response building
All callers of qmp_build_error_object() duplicate the code to wrap it in a response object. Replace it by qmp_error_response() that captures the duplicated code, including error_free(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180703085358.13941-23-armbru@redhat.com>
This commit is contained in:
parent
a193352ff9
commit
cee32796ca
4 changed files with 15 additions and 22 deletions
|
@ -4107,14 +4107,9 @@ static int monitor_can_read(void *opaque)
|
|||
static void monitor_qmp_respond(Monitor *mon, QObject *rsp,
|
||||
Error *err, QObject *id)
|
||||
{
|
||||
QDict *qdict = NULL;
|
||||
|
||||
if (err) {
|
||||
assert(!rsp);
|
||||
qdict = qdict_new();
|
||||
qdict_put_obj(qdict, "error", qmp_build_error_object(err));
|
||||
error_free(err);
|
||||
rsp = QOBJECT(qdict);
|
||||
rsp = QOBJECT(qmp_error_response(err));
|
||||
}
|
||||
|
||||
if (rsp) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue