From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com
Subject: [Qemu-devel] [PATCH 3/4] monitor: Remove uneeded goto
Date: Tue, 9 Jun 2009 18:21:54 -0300 [thread overview]
Message-ID: <20090609182154.4be10dd3@redhat.com> (raw)
In-Reply-To: <cover.1244582237.git.lcapitulino@redhat.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 <lcapitulino@redhat.com>
---
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
next prev parent reply other threads:[~2009-06-09 21:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1244582237.git.lcapitulino@redhat.com>
2009-06-09 21:20 ` [Qemu-devel] [PATCH 1/4] monitor: Remove unused variable Luiz Capitulino
2009-06-09 21:21 ` [Qemu-devel] [PATCH 2/4] monitor: Introduce get_command_name() Luiz Capitulino
2009-06-09 21:21 ` Luiz Capitulino [this message]
2009-06-09 21:22 ` [Qemu-devel] [PATCH 4/4] monitor: Remove uneeded 'return' statement Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090609182154.4be10dd3@redhat.com \
--to=lcapitulino@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).