Commit d91d9bf617aa560082d7d5c5f405d6b70f7b42c9
Committed by
Blue Swirl
1 parent
3a41759d
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>
Showing
1 changed file
with
6 additions
and
4 deletions
monitor.c
... | ... | @@ -2432,11 +2432,13 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) |
2432 | 2432 | /* find the command */ |
2433 | 2433 | for(cmd = mon_cmds; cmd->name != NULL; cmd++) { |
2434 | 2434 | if (compare_cmd(cmdname, cmd->name)) |
2435 | - goto found; | |
2435 | + break; | |
2436 | + } | |
2437 | + | |
2438 | + if (cmd->name == NULL) { | |
2439 | + monitor_printf(mon, "unknown command: '%s'\n", cmdname); | |
2440 | + return; | |
2436 | 2441 | } |
2437 | - monitor_printf(mon, "unknown command: '%s'\n", cmdname); | |
2438 | - return; | |
2439 | - found: | |
2440 | 2442 | |
2441 | 2443 | for(i = 0; i < MAX_ARGS; i++) |
2442 | 2444 | str_allocated[i] = NULL; | ... | ... |