Patchwork [25/25] Monitor: do_info(): Drop unused code

login
register
mail settings
Submitter Luiz Capitulino
Date Dec. 6, 2010, 6:24 p.m.
Message ID <1291659852-23028-26-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/74455/
State New
Headers show

Comments

Luiz Capitulino - Dec. 6, 2010, 6:24 p.m.
Last commits moved QMP calling code to the info handlers themselves,
now do_info() does nothing with QMP anymore, just drop all QMP handling
code from it.

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

Patch

diff --git a/monitor.c b/monitor.c
index d07608e..8bfd755 100644
--- a/monitor.c
+++ b/monitor.c
@@ -661,28 +661,14 @@  static void user_async_cmd_handler(Monitor *mon, const mon_cmd_t *cmd,
     }
 }
 
-static void user_async_info_handler(Monitor *mon, const mon_cmd_t *cmd)
-{
-    int ret;
-
-    MonitorCompletionData *cb_data = qemu_malloc(sizeof(*cb_data));
-    cb_data->mon = mon;
-    cb_data->user_print = cmd->user_print;
-    monitor_suspend(mon);
-    ret = cmd->mhandler.info_async(mon, user_monitor_complete, cb_data);
-    if (ret < 0) {
-        monitor_resume(mon);
-        qemu_free(cb_data);
-    }
-}
-
 static void do_info(Monitor *mon, const QDict *qdict)
 {
     const mon_cmd_t *cmd;
     const char *item = qdict_get_try_str(qdict, "item");
 
     if (!item) {
-        goto help;
+        help_cmd(mon, "info");
+        return;
     }
 
     for (cmd = info_cmds; cmd->name != NULL; cmd++) {
@@ -690,28 +676,12 @@  static void do_info(Monitor *mon, const QDict *qdict)
             break;
     }
 
-    if (cmd->name == NULL) {
-        goto help;
-    }
-
-    if (handler_is_async(cmd)) {
-        user_async_info_handler(mon, cmd);
-    } else if (handler_is_qobject(cmd)) {
-        QObject *info_data = NULL;
-
-        cmd->mhandler.info_new(mon, &info_data);
-        if (info_data) {
-            cmd->user_print(mon, info_data);
-            qobject_decref(info_data);
-        }
-    } else {
-        cmd->mhandler.info(mon);
+    if (!cmd->name) {
+        help_cmd(mon, "info");
+        return;
     }
 
-    return;
-
-help:
-    help_cmd(mon, "info");
+    cmd->mhandler.info(mon);
 }
 
 static void do_info_balloon(Monitor *mon)