Patchwork [20/23] Monitor: Directly call QObject handlers

login
register
mail settings
Submitter Luiz Capitulino
Date Oct. 1, 2010, 6:19 p.m.
Message ID <1285957167-1228-21-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/66486/
State New
Headers show

Comments

Luiz Capitulino - Oct. 1, 2010, 6:19 p.m.
This avoids handle_user_command() calling monitor_call_handler(),
which is currently shared with QMP.

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

Patch

diff --git a/monitor.c b/monitor.c
index 7959504..03f3c18 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3917,7 +3917,15 @@  static void handle_user_command(Monitor *mon, const char *cmdline)
     if (handler_is_async(cmd)) {
         user_async_cmd_handler(mon, cmd, qdict);
     } else if (handler_is_qobject(cmd)) {
-        monitor_call_handler(mon, cmd, qdict);
+        QObject *data = NULL;
+
+        /* XXX: ignores the error code */
+        cmd->mhandler.cmd_new(mon, qdict, &data);
+        assert(!monitor_has_error(mon));
+        if (data) {
+            cmd->user_print(mon, data);
+            qobject_decref(data);
+        }
     } else {
         cmd->mhandler.cmd(mon, qdict);
     }