aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2009-10-07 13:41:52 -0300
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-08 21:17:18 -0500
commitaf4ce882d530d4aa9ed26de3423a36e4a156d0a5 (patch)
tree4e370c27d5b60c410f3011530a9c03f935933806 /monitor.c
parent910df89d8767b68fabb36d785f8ea0458b41bda3 (diff)
monitor: union for command handlers
This commits adds a new union member to mon_cmd_t for command handlers and convert monitor_handle_command() and qemu-monitor.hx to use it. This improves type safety. Patchworks-ID: 35337 Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/monitor.c b/monitor.c
index c0569d5587..2bf82f3c66 100644
--- a/monitor.c
+++ b/monitor.c
@@ -71,11 +71,11 @@
typedef struct mon_cmd_t {
const char *name;
const char *args_type;
- void *handler;
const char *params;
const char *help;
union {
void (*info)(Monitor *mon);
+ void (*cmd)(Monitor *mon, const QDict *qdict);
} mhandler;
} mon_cmd_t;
@@ -3014,13 +3014,8 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline)
cmd = monitor_parse_command(mon, cmdline, qdict);
if (cmd) {
- void (*handler)(Monitor *mon, const QDict *qdict);
-
qemu_errors_to_mon(mon);
-
- handler = cmd->handler;
- handler(mon, qdict);
-
+ cmd->mhandler.cmd(mon, qdict);
qemu_errors_to_previous();
}