From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ME8li-0006Jv-C7 for qemu-devel@nongnu.org; Tue, 09 Jun 2009 17:22:06 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ME8ld-0006IB-Ri for qemu-devel@nongnu.org; Tue, 09 Jun 2009 17:22:05 -0400 Received: from [199.232.76.173] (port=43427 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ME8ld-0006I5-Kc for qemu-devel@nongnu.org; Tue, 09 Jun 2009 17:22:01 -0400 Received: from mx2.redhat.com ([66.187.237.31]:51624) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ME8ld-0002e3-7d for qemu-devel@nongnu.org; Tue, 09 Jun 2009 17:22:01 -0400 Date: Tue, 9 Jun 2009 18:21:54 -0300 From: Luiz Capitulino Message-ID: <20090609182154.4be10dd3@redhat.com> In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 3/4] monitor: Remove uneeded goto List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com 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 --- monitor.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/monitor.c b/monitor.c index 9b11341..0ef3bce 100644 --- a/monitor.c +++ b/monitor.c @@ -2446,11 +2446,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; -- 1.6.3.GIT