From: Bandan Das <bsd@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5 2/4] monitor: cleanup parsing of cmd name and cmd arguments
Date: Fri, 12 Jun 2015 18:12:30 -0400 [thread overview]
Message-ID: <jpgfv5wd19t.fsf@redhat.com> (raw)
In-Reply-To: <874mmd797p.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Fri, 12 Jun 2015 08:05:14 +0200")
Markus Armbruster <armbru@redhat.com> writes:
> Bandan Das <bsd@redhat.com> writes:
>
>> There's too much going on in monitor_parse_command().
>> Split up the arguments parsing bits into a separate function
>> monitor_parse_arguments(). Let the original function check for
>> command validity and sub-commands if any and return data (*cmd)
>> that the newly introduced function can process and return a
>> QDict. Also, pass a pointer to the cmdline to track current
>> parser location.
>>
>> Suggested-by: Markus Armbruster <armbru@redhat.com>
>> Signed-off-by: Bandan Das <bsd@redhat.com>
>
> Doesn't apply cleanly anymore. Please double-check my conflict
> resolution carefully:
Looks good, Markus. Thank you for taking care of the conflict.
Bandan
> diff --git a/monitor.c b/monitor.c
> index bcb88cd..0b0a8df 100644
> --- a/monitor.c
> +++ b/monitor.c
> [...]
> @@ -4156,13 +4168,17 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
> QDict *qdict;
> const mon_cmd_t *cmd;
>
> - qdict = qdict_new();
> + cmd = monitor_parse_command(mon, &cmdline, mon->cmd_table);
> + if (!cmd) {
> + return;
> + }
>
> - cmd = monitor_parse_command(mon, cmdline, 0, mon->cmd_table, qdict);
> - if (cmd) {
> - cmd->mhandler.cmd(mon, qdict);
> + qdict = monitor_parse_arguments(mon, &cmdline, cmd);
> + if (!qdict) {
> + return;
> }
>
> + cmd->mhandler.cmd(mon, qdict);
> QDECREF(qdict);
> }
>
next prev parent reply other threads:[~2015-06-12 22:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 22:38 [Qemu-devel] [PATCH v5 0/4] monitor: suggest running "help" for command errors Bandan Das
2015-06-03 22:38 ` [Qemu-devel] [PATCH v5 1/4] monitor: remove debug prints Bandan Das
2015-06-03 22:38 ` [Qemu-devel] [PATCH v5 2/4] monitor: cleanup parsing of cmd name and cmd arguments Bandan Das
2015-06-12 6:05 ` Markus Armbruster
2015-06-12 22:12 ` Bandan Das [this message]
2015-06-03 22:38 ` [Qemu-devel] [PATCH v5 3/4] monitor: Point to "help" command on syntax error Bandan Das
2015-06-03 22:38 ` [Qemu-devel] [PATCH v5 4/4] monitor: Fix failure path for "S" argument Bandan Das
2015-06-08 8:53 ` [Qemu-devel] [PATCH v5 0/4] monitor: suggest running "help" for command errors Markus Armbruster
2015-06-11 17:58 ` Luiz Capitulino
2015-06-16 15:10 ` Markus Armbruster
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=jpgfv5wd19t.fsf@redhat.com \
--to=bsd@redhat.com \
--cc=armbru@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.