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 <arm...@redhat.com> --- 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