mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
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>
This commit is contained in:
parent
65e3fe6743
commit
1816604b62
13
monitor.c
13
monitor.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user