[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-5.1 5/8] qemu-option: Fix has_help_option()'s sloppy pars
From: |
Kevin Wolf |
Subject: |
Re: [PATCH for-5.1 5/8] qemu-option: Fix has_help_option()'s sloppy parsing |
Date: |
Tue, 14 Apr 2020 16:57:35 +0200 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
Am 14.04.2020 um 12:16 hat Markus Armbruster geschrieben:
> Eric Blake <address@hidden> writes:
>
> > On 4/9/20 10:30 AM, Markus Armbruster wrote:
> >> has_help_option() uses its own parser. It's inconsistent with
> >> qemu_opts_parse(), as demonstrated by test-qemu-opts case
> >> /qemu-opts/has_help_option. Fix by reusing the common parser.
> >>
> >> Signed-off-by: Markus Armbruster <address@hidden>
> >> @@ -165,26 +165,6 @@ void parse_option_size(const char *name, const char
> >> *value,
> >> *ret = size;
> >> }
> >> -bool has_help_option(const char *param)
> >> -{
> >> - const char *p = param;
> >> - bool result = false;
> >> -
> >> - while (*p && !result) {
> >> - char *value;
> >> -
> >> - p = get_opt_value(p, &value);
> >> - if (*p) {
> >> - p++;
> >> - }
> >> -
> >> - result = is_help_option(value);
> >
> > Old code: both 'help' and '?' are accepted.
> >
> >> +bool has_help_option(const char *params)
> >> +{
> >> + const char *p;
> >> + char *name, *value;
> >> + bool ret;
> >> +
> >> + for (p = params; *p;) {
> >> + p = get_opt_name_value(p, NULL, &name, &value);
> >> + ret = !strcmp(name, "help");
> >
> > New code: only 'help' is accepted. Is the loss of '?' intentional?
>
> No. Will fix, thanks!
Please also add some '?' test cases while you're at it.
Kevin
- Re: [PATCH for-5.1 2/8] qemu-options: Factor out get_opt_name_value() helper, (continued)
Re: [PATCH for-5.1 2/8] qemu-options: Factor out get_opt_name_value() helper, Kevin Wolf, 2020/04/14
[PATCH for-5.1 7/8] qemu-img: Factor out accumulate_options() helper, Markus Armbruster, 2020/04/09
[PATCH for-5.1 5/8] qemu-option: Fix has_help_option()'s sloppy parsing, Markus Armbruster, 2020/04/09
[PATCH for-5.1 1/8] tests-qemu-opts: Cover has_help_option(), qemu_opt_has_help_opt(), Markus Armbruster, 2020/04/09
- Re: [PATCH for-5.1 1/8] tests-qemu-opts: Cover has_help_option(), qemu_opt_has_help_opt(), Eric Blake, 2020/04/09
- Re: [PATCH for-5.1 1/8] tests-qemu-opts: Cover has_help_option(), qemu_opt_has_help_opt(), Markus Armbruster, 2020/04/14
- Re: [PATCH for-5.1 1/8] tests-qemu-opts: Cover has_help_option(), qemu_opt_has_help_opt(), Kevin Wolf, 2020/04/14
- Re: [PATCH for-5.1 1/8] tests-qemu-opts: Cover has_help_option(), qemu_opt_has_help_opt(), Markus Armbruster, 2020/04/14
- Re: [PATCH for-5.1 1/8] tests-qemu-opts: Cover has_help_option(), qemu_opt_has_help_opt(), Kevin Wolf, 2020/04/14
- Re: [PATCH for-5.1 1/8] tests-qemu-opts: Cover has_help_option(), qemu_opt_has_help_opt(), Markus Armbruster, 2020/04/14
- Re: [PATCH for-5.1 1/8] tests-qemu-opts: Cover has_help_option(), qemu_opt_has_help_opt(), Kevin Wolf, 2020/04/15
- Re: [PATCH for-5.1 1/8] tests-qemu-opts: Cover has_help_option(), qemu_opt_has_help_opt(), Markus Armbruster, 2020/04/15