summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2010-11-22 16:35:09 -0200
committerLuiz Capitulino <lcapitulino@redhat.com>2010-12-06 09:51:41 -0200
commit6d44143054293995c5e92fbddbd1ee92846013cc (patch)
tree90f4b4c7c89a22bf6676e2c733aeeebd6a07b80c /monitor.c
parentc01e68853148764d32c3a27ab4b39cb553c567fc (diff)
downloadqemu-6d44143054293995c5e92fbddbd1ee92846013cc.tar.gz
qemu-6d44143054293995c5e92fbddbd1ee92846013cc.tar.bz2
qemu-6d44143054293995c5e92fbddbd1ee92846013cc.zip
QMP: Drop dead code
The first if/else clause in handler_audit() makes no sense for two reasons: 1. this function is now called only by QMP code, so testing if it's a QMP call makes no sense anymore 2. the else clause first asserts that there's no error in the monitor object, then it tries to free it! Just drop it. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c74
1 files changed, 34 insertions, 40 deletions
diff --git a/monitor.c b/monitor.c
index 1296c40256..1e8b1fc9bc 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3891,49 +3891,43 @@ void monitor_set_error(Monitor *mon, QError *qerror)
static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret)
{
- if (monitor_ctrl_mode(mon)) {
- if (ret && !monitor_has_error(mon)) {
- /*
- * If it returns failure, it must have passed on error.
- *
- * Action: Report an internal error to the client if in QMP.
- */
- qerror_report(QERR_UNDEFINED_ERROR);
- MON_DEBUG("command '%s' returned failure but did not pass an error\n",
- cmd->name);
- }
+ if (ret && !monitor_has_error(mon)) {
+ /*
+ * If it returns failure, it must have passed on error.
+ *
+ * Action: Report an internal error to the client if in QMP.
+ */
+ qerror_report(QERR_UNDEFINED_ERROR);
+ MON_DEBUG("command '%s' returned failure but did not pass an error\n",
+ cmd->name);
+ }
#ifdef CONFIG_DEBUG_MONITOR
- if (!ret && monitor_has_error(mon)) {
- /*
- * If it returns success, it must not have passed an error.
- *
- * Action: Report the passed error to the client.
- */
- MON_DEBUG("command '%s' returned success but passed an error\n",
- cmd->name);
- }
-
- if (mon_print_count_get(mon) > 0 && strcmp(cmd->name, "info") != 0) {
- /*
- * Handlers should not call Monitor print functions.
- *
- * Action: Ignore them in QMP.
- *
- * (XXX: we don't check any 'info' or 'query' command here
- * because the user print function _is_ called by do_info(), hence
- * we will trigger this check. This problem will go away when we
- * make 'query' commands real and kill do_info())
- */
- MON_DEBUG("command '%s' called print functions %d time(s)\n",
- cmd->name, mon_print_count_get(mon));
- }
-#endif
- } else {
- assert(!monitor_has_error(mon));
- QDECREF(mon->error);
- mon->error = NULL;
+ if (!ret && monitor_has_error(mon)) {
+ /*
+ * If it returns success, it must not have passed an error.
+ *
+ * Action: Report the passed error to the client.
+ */
+ MON_DEBUG("command '%s' returned success but passed an error\n",
+ cmd->name);
+ }
+
+ if (mon_print_count_get(mon) > 0 && strcmp(cmd->name, "info") != 0) {
+ /*
+ * Handlers should not call Monitor print functions.
+ *
+ * Action: Ignore them in QMP.
+ *
+ * (XXX: we don't check any 'info' or 'query' command here
+ * because the user print function _is_ called by do_info(), hence
+ * we will trigger this check. This problem will go away when we
+ * make 'query' commands real and kill do_info())
+ */
+ MON_DEBUG("command '%s' called print functions %d time(s)\n",
+ cmd->name, mon_print_count_get(mon));
}
+#endif
}
static void handle_user_command(Monitor *mon, const char *cmdline)