summaryrefslogtreecommitdiffstats
path: root/monitor.c
diff options
context:
space:
mode:
authorLuiz Capitulino2009-06-09 23:21:54 +0200
committerBlue Swirl2009-06-10 18:45:49 +0200
commitd91d9bf617aa560082d7d5c5f405d6b70f7b42c9 (patch)
tree8c80d3d1560100f2aab66516dd6aef685851e829 /monitor.c
parentUse snprintf to avoid OpenBSD warning (diff)
downloadqemu-d91d9bf617aa560082d7d5c5f405d6b70f7b42c9.tar.gz
qemu-d91d9bf617aa560082d7d5c5f405d6b70f7b42c9.tar.xz
qemu-d91d9bf617aa560082d7d5c5f405d6b70f7b42c9.zip
monitor: Remove uneeded goto
The 'found' goto in monitor_handle_command() can be dropped if we check for 'cmd->name' after looking up for the command to execute. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/monitor.c b/monitor.c
index 7620bdebfe..fd9175257a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2432,11 +2432,13 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline)
/* find the command */
for(cmd = mon_cmds; cmd->name != NULL; cmd++) {
if (compare_cmd(cmdname, cmd->name))
- goto found;
+ break;
+ }
+
+ if (cmd->name == NULL) {
+ monitor_printf(mon, "unknown command: '%s'\n", cmdname);
+ return;
}
- monitor_printf(mon, "unknown command: '%s'\n", cmdname);
- return;
- found:
for(i = 0; i < MAX_ARGS; i++)
str_allocated[i] = NULL;