[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 09/20] qmp: simplify qmp_return_error()
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [PATCH v5 09/20] qmp: simplify qmp_return_error() |
Date: |
Mon, 15 Jul 2019 23:09:50 +0400 |
It's simple, probably more efficient, to hand-craft the dict.
Signed-off-by: Marc-André Lureau <address@hidden>
---
qapi/qmp-dispatch.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 405cb291b1..5f75dc27bd 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -50,10 +50,10 @@ void qmp_return(QmpReturn *qret, QObject *rsp)
void qmp_return_error(QmpReturn *qret, Error *err)
{
- qdict_put_obj(qret->rsp, "error",
- qobject_from_jsonf_nofail("{ 'class': %s, 'desc': %s }",
- QapiErrorClass_str(error_get_class(err)),
- error_get_pretty(err)));
+ QDict *qdict = qdict_new();
+ qdict_put_str(qdict, "class", QapiErrorClass_str(error_get_class(err)));
+ qdict_put_str(qdict, "desc", error_get_pretty(err));
+ qdict_put_obj(qret->rsp, "error", QOBJECT(qdict));
error_free(err);
qret->session->return_cb(qret->session, qret->rsp);
qmp_return_free(qret);
--
2.22.0.428.g6d5b264208
- [Qemu-devel] [PATCH v5 00/20] monitor: add asynchronous command type, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 01/20] qmp: constify QmpCommand and list, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 02/20] json-lexer: make it safe to call destroy multiple times, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 03/20] qmp: add QmpSession, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 04/20] QmpSession: add a return callback, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 05/20] QmpSession: add json parser and use it in qga, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 06/20] monitor: use qmp session to parse json feed, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 07/20] qga: simplify dispatch_return_cb, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 08/20] QmpSession: introduce QmpReturn, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 09/20] qmp: simplify qmp_return_error(),
Marc-André Lureau <=
- [Qemu-devel] [PATCH v5 10/20] QmpSession: keep a queue of pending commands, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 11/20] QmpSession: return orderly, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 12/20] qmp: introduce asynchronous command type, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 13/20] scripts: learn 'async' qapi commands, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 14/20] qmp: add qmp_return_is_cancelled(), Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 15/20] monitor: add qmp_return_get_monitor(), Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 16/20] console: add graphic_hw_update_done(), Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 17/20] console: make screendump asynchronous, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 18/20] monitor: start making qmp_human_monitor_command() asynchronous, Marc-André Lureau, 2019/07/15
- [Qemu-devel] [PATCH v5 19/20] monitor: teach HMP about asynchronous commands, Marc-André Lureau, 2019/07/15