[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/11] Monitor: Introduce find_info_cmd()
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 09/11] Monitor: Introduce find_info_cmd() |
Date: |
Thu, 21 Jan 2010 19:09:38 -0200 |
Move the code used to locate an info command entry to its
own function, as it's going to be used by other functions.
Signed-off-by: Luiz Capitulino <address@hidden>
---
monitor.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/monitor.c b/monitor.c
index 321bc3a..34df1cc 100644
--- a/monitor.c
+++ b/monitor.c
@@ -512,6 +512,19 @@ static void do_async_msg_disable(Monitor *mon, const QDict
*qdict,
qevent_set_value(mon, qdict, 0);
}
+static const mon_cmd_t *monitor_find_info_command(const char *name)
+{
+ const mon_cmd_t *cmd;
+
+ for (cmd = info_cmds; cmd->name != NULL; cmd++) {
+ if (compare_cmd(name, cmd->name)) {
+ return cmd;
+ }
+ }
+
+ return NULL;
+}
+
static void do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
const mon_cmd_t *cmd;
@@ -522,12 +535,8 @@ static void do_info(Monitor *mon, const QDict *qdict,
QObject **ret_data)
goto help;
}
- for (cmd = info_cmds; cmd->name != NULL; cmd++) {
- if (compare_cmd(item, cmd->name))
- break;
- }
-
- if (cmd->name == NULL) {
+ cmd = monitor_find_info_command(item);
+ if (!cmd) {
if (monitor_ctrl_mode(mon)) {
qemu_error_new(QERR_COMMAND_NOT_FOUND, item);
return;
--
1.6.6
[Qemu-devel] Re: [PATCH 08/11] QMP: Asynchronous messages enable/disable support, Avi Kivity, 2010/01/24
[Qemu-devel] [PATCH 09/11] Monitor: Introduce find_info_cmd(),
Luiz Capitulino <=
[Qemu-devel] [PATCH 10/11] QError: New QERR_QMP_INVALID_MODE_COMMAND, Luiz Capitulino, 2010/01/21
[Qemu-devel] [PATCH 11/11] QMP: Enable feature negotiation support, Luiz Capitulino, 2010/01/21
Re: [Qemu-devel] [RFC 00/11]: QMP feature negotiation support, Markus Armbruster, 2010/01/22
Re: [Qemu-devel] [RFC 00/11]: QMP feature negotiation support, Anthony Liguori, 2010/01/22