diff mbox

[21/25] Monitor: Convert do_info_uuid_print() into do_info_uuid()

Message ID 1291659852-23028-22-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino Dec. 6, 2010, 6:24 p.m. UTC
The new handler directly calls qmp_query_uuid() to gather
data and then prints it. This change allows us to drop the
user_print callback.

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

Patch

diff --git a/monitor.c b/monitor.c
index e9b07f3..3b6137e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -818,9 +818,13 @@  static void qmp_query_uuid(Monitor *mon, QObject **ret_data)
     *ret_data = qobject_from_jsonf("{ 'UUID': %s }", uuid);
 }
 
-static void do_info_uuid_print(Monitor *mon, const QObject *data)
+static void do_info_uuid(Monitor *mon)
 {
+    QObject *data;
+
+    qmp_query_uuid(NULL, &data);
     monitor_printf(mon, "%s\n", qdict_get_str(qobject_to_qdict(data), "UUID"));
+    qobject_decref(data);
 }
 
 /* get the current CPU defined by the user */
@@ -2586,8 +2590,7 @@  static const mon_cmd_t info_cmds[] = {
         .args_type  = "",
         .params     = "",
         .help       = "show the current VM UUID",
-        .user_print = do_info_uuid_print,
-        .mhandler.info_new = qmp_query_uuid,
+        .mhandler.info = do_info_uuid,
     },
 #if defined(TARGET_PPC)
     {