diff options
author | Markus Armbruster <armbru@redhat.com> | 2018-07-03 10:53:51 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2018-07-03 23:18:56 +0200 |
commit | 1816604b62f4c5ac1032374a941638f2fe199104 (patch) | |
tree | 97c9c2608b8e6080352464c3dd92380c80e58eb3 | |
parent | 65e3fe6743af08bd0bc79b3d6158e91d572afc57 (diff) |
qmp: Replace get_qmp_greeting() by qmp_greeting()
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 <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180703085358.13941-26-armbru@redhat.com>
-rw-r--r-- | monitor.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -4382,7 +4382,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; @@ -4398,8 +4398,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) @@ -4409,15 +4410,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; |