[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 25/32] qmp: Replace get_qmp_greeting() by qmp_gre
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v2 25/32] qmp: Replace get_qmp_greeting() by qmp_greeting() |
Date: |
Tue, 3 Jul 2018 10:53:51 +0200 |
get_qmp_greeting() returns a QDict * as QObject *. It's caller
converts it right back.
Return QDict * instead. While there, rename to qmp_greeting().
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
monitor.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/monitor.c b/monitor.c
index 399ad6b4e0..ba3124514c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4381,7 +4381,7 @@ void monitor_resume(Monitor *mon)
trace_monitor_suspend(mon, -1);
}
-static QObject *get_qmp_greeting(Monitor *mon)
+static QDict *qmp_greeting(Monitor *mon)
{
QList *cap_list = qlist_new();
QObject *ver = NULL;
@@ -4397,8 +4397,9 @@ static QObject *get_qmp_greeting(Monitor *mon)
qlist_append_str(cap_list, QMPCapability_str(cap));
}
- return qobject_from_jsonf("{'QMP': {'version': %p, 'capabilities': %p}}",
- ver, cap_list);
+ return qdict_from_jsonf_nofail(
+ "{'QMP': {'version': %p, 'capabilities': %p}}",
+ ver, cap_list);
}
static void monitor_qmp_caps_reset(Monitor *mon)
@@ -4408,15 +4409,15 @@ static void monitor_qmp_caps_reset(Monitor *mon)
static void monitor_qmp_event(void *opaque, int event)
{
- QObject *data;
+ QDict *data;
Monitor *mon = opaque;
switch (event) {
case CHR_EVENT_OPENED:
mon->qmp.commands = &qmp_cap_negotiation_commands;
monitor_qmp_caps_reset(mon);
- data = get_qmp_greeting(mon);
- qmp_queue_response(mon, qobject_to(QDict, data));
+ data = qmp_greeting(mon);
+ qmp_queue_response(mon, data);
qobject_unref(data);
mon_refcount++;
break;
--
2.17.1
- [Qemu-devel] [PATCH v2 15/32] qmp: Simplify code around monitor_qmp_dispatch_one(), (continued)
- [Qemu-devel] [PATCH v2 15/32] qmp: Simplify code around monitor_qmp_dispatch_one(), Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 01/32] qmp: Say "out-of-band" instead of "Out-Of-Band", Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 02/32] monitor: Spell "I/O thread" consistently in comments, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 29/32] qobject: Let qobject_from_jsonf() fail instead of abort, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 26/32] qmp: Simplify monitor_qmp_respond(), Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 05/32] qmp: Get rid of x-oob-test command, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 18/32] qmp: Don't let JSON errors jump the queue, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 22/32] qmp: De-duplicate error response building, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 09/32] qmp qemu-ga: Revert change that accidentally made qemu-ga accept "id", Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 25/32] qmp: Replace get_qmp_greeting() by qmp_greeting(),
Markus Armbruster <=
- [Qemu-devel] [PATCH v2 11/32] qmp qemu-ga: Fix qemu-ga not to accept "control", Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 17/32] qmp: Don't let malformed in-band commands jump the queue, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 27/32] qmp: Add some comments around null responses, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 24/32] qmp: Replace monitor_json_emitter{, raw}() by qmp_{queue, send}_response(), Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 07/32] qmp: Make "id" optional again even in "oob" monitors, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 12/32] qmp: Redo how the client requests out-of-band execution, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 31/32] monitor: Improve some comments, Markus Armbruster, 2018/07/03
- [Qemu-devel] [PATCH v2 20/32] monitor: Peel off @mon_global wrapper, Markus Armbruster, 2018/07/03