qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 2/4] monitor: cleanup parsing of cmd name and


From: Bandan Das
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Markus Armbruster <address@hidden> writes:

> Bandan Das <address@hidden> 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 <address@hidden>
>> Signed-off-by: Bandan Das <address@hidden>
>
> 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);
>  }
>  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]