qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 25/25] Monitor: do_info(): Drop unused code


From: Luiz Capitulino
Subject: [Qemu-devel] [PATCH 25/25] Monitor: do_info(): Drop unused code
Date: Mon, 6 Dec 2010 16:24:12 -0200

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 <address@hidden>
---
 monitor.c |   42 ++++++------------------------------------
 1 files changed, 6 insertions(+), 36 deletions(-)

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)
-- 
1.7.3.3.398.g0b0cd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]