Patchwork [07/17] monitor: Convert do_info_name() to QObject

login
register
mail settings
Submitter Luiz Capitulino
Date Nov. 17, 2009, 8:32 p.m.
Message ID <1258489944-12159-8-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/38712/
State New
Headers show

Comments

Luiz Capitulino - Nov. 17, 2009, 8:32 p.m.
The returned QObject is a QString.

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

Patch

diff --git a/monitor.c b/monitor.c
index 1a37be3..5140198 100644
--- a/monitor.c
+++ b/monitor.c
@@ -349,10 +349,15 @@  static void do_info_version(Monitor *mon, QObject **ret_data)
     *ret_data = QOBJECT(qstring_from_str(QEMU_VERSION QEMU_PKGVERSION));
 }
 
-static void do_info_name(Monitor *mon)
+/**
+ * do_info_name(): Show VM name
+ *
+ * Return a QString with the current VM name.
+ */
+static void do_info_name(Monitor *mon, QObject **ret_data)
 {
     if (qemu_name)
-        monitor_printf(mon, "%s\n", qemu_name);
+        *ret_data = QOBJECT(qstring_from_str(qemu_name));
 }
 
 #if defined(TARGET_I386)
@@ -2185,7 +2190,8 @@  static const mon_cmd_t info_cmds[] = {
         .args_type  = "",
         .params     = "",
         .help       = "show the current VM name",
-        .mhandler.info = do_info_name,
+        .user_print = monitor_print_qobject,
+        .mhandler.info_new = do_info_name,
     },
     {
         .name       = "uuid",