monitor: Remove uneeded goto
authorLuiz Capitulino <lcapitulino@redhat.com>
Tue, 9 Jun 2009 21:21:54 +0000 (18:21 -0300)
committerBlue Swirl <blauwirbel@gmail.com>
Wed, 10 Jun 2009 16:45:49 +0000 (19:45 +0300)
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>
monitor.c

index 7620bdebfe8623e5ab14a892ea138d6c2e2e83f3..fd9175257ab64b3eb59fe0bc91f675e3d99e0f56 100644 (file)
--- 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;