Patchwork [17/18] hmp: allow "bool" parameter to be optional

login
register
mail settings
Submitter Pavel Hrdina
Date Aug. 15, 2012, 7:41 a.m.
Message ID <46a2c15ae1bcd86a09bf979a624fd3e83a3b7626.1345016001.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/177583/
State New
Headers show

Comments

Pavel Hrdina - Aug. 15, 2012, 7:41 a.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 monitor.c | 3 +++
 1 file changed, 3 insertions(+)
Eric Blake - Aug. 16, 2012, 4:39 a.m.
On 08/15/2012 01:41 AM, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  monitor.c | 3 +++
>  1 file changed, 3 insertions(+)

NACK.  See patch 18 why I think you don't need this.

> 
> diff --git a/monitor.c b/monitor.c
> index db9a8d0..a538e6a 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3769,6 +3769,9 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon,
>                      val = 1;
>                  } else if (p - beg == 3 && !memcmp(beg, "off", p - beg)) {
>                      val = 0;
> +                } else if (*typestr == '?') {
> +                    typestr++;
> +                    break;
>                  } else {
>                      monitor_printf(mon, "Expected 'on' or 'off'\n");
>                      goto fail;
>

Patch

diff --git a/monitor.c b/monitor.c
index db9a8d0..a538e6a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3769,6 +3769,9 @@  static const mon_cmd_t *monitor_parse_command(Monitor *mon,
                     val = 1;
                 } else if (p - beg == 3 && !memcmp(beg, "off", p - beg)) {
                     val = 0;
+                } else if (*typestr == '?') {
+                    typestr++;
+                    break;
                 } else {
                     monitor_printf(mon, "Expected 'on' or 'off'\n");
                     goto fail;