The new handler directly calls qmp_query_kvm() to gather
data and then prints it. This change allows us to drop the
user_print callback.

Signed-off-by: Luiz Capitulino <lcapitul...@redhat.com>
---
 monitor.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/monitor.c b/monitor.c
index e8f0562..4286375 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2004,10 +2004,12 @@ static void qmp_query_kvm(Monitor *mon, QObject 
**ret_data)
 #endif
 }
 
-static void do_info_kvm_print(Monitor *mon, const QObject *data)
+static void do_info_kvm(Monitor *mon)
 {
+    QObject *data;
     QDict *qdict;
 
+    qmp_query_kvm(NULL, &data);
     qdict = qobject_to_qdict(data);
 
     monitor_printf(mon, "kvm support: ");
@@ -2017,6 +2019,8 @@ static void do_info_kvm_print(Monitor *mon, const QObject 
*data)
     } else {
         monitor_printf(mon, "not compiled\n");
     }
+
+    qobject_decref(data);
 }
 
 static void do_info_numa(Monitor *mon)
@@ -2490,8 +2494,7 @@ static const mon_cmd_t info_cmds[] = {
         .args_type  = "",
         .params     = "",
         .help       = "show KVM information",
-        .user_print = do_info_kvm_print,
-        .mhandler.info_new = qmp_query_kvm,
+        .mhandler.info = do_info_kvm,
     },
     {
         .name       = "numa",
-- 
1.7.3.3.398.g0b0cd


Reply via email to