aboutsummaryrefslogtreecommitdiff
path: root/monitor/qmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor/qmp.c')
-rw-r--r--monitor/qmp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/monitor/qmp.c b/monitor/qmp.c
index 7c3d081a72..940649f688 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -87,8 +87,7 @@ void qmp_send_response(MonitorQMP *mon, const QDict *rsp)
const QObject *data = QOBJECT(rsp);
QString *json;
- json = mon->common.flags & MONITOR_USE_PRETTY ?
- qobject_to_json_pretty(data) : qobject_to_json(data);
+ json = mon->pretty ? qobject_to_json_pretty(data) : qobject_to_json(data);
assert(json != NULL);
qstring_append_chr(json, '\n');
@@ -373,9 +372,11 @@ void monitor_init_qmp(Chardev *chr, int flags)
assert(!(flags & MONITOR_USE_READLINE));
/* Note: we run QMP monitor in I/O thread when @chr supports that */
- monitor_data_init(&mon->common, flags, false,
+ monitor_data_init(&mon->common, true, false,
qemu_chr_has_feature(chr, QEMU_CHAR_FEATURE_GCONTEXT));
+ mon->pretty = flags & MONITOR_USE_PRETTY;
+
qemu_mutex_init(&mon->qmp_queue_lock);
mon->qmp_requests = g_queue_new();