qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 06/16] qemu-option: qemu_opts_validate(): use er


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH 06/16] qemu-option: qemu_opts_validate(): use error_set()
Date: Fri, 18 May 2012 16:18:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120422 Thunderbird/10.0.4

On 05/17/12 16:33, Luiz Capitulino wrote:

> @@ -1060,21 +1060,18 @@ int qemu_opts_validate(QemuOpts *opts, const 
> QemuOptDesc *desc)
>              }
>          }
>          if (desc[i].name == NULL) {
> -            qerror_report(QERR_INVALID_PARAMETER, opt->name);
> -            return -1;
> +            error_set(errp, QERR_INVALID_PARAMETER, opt->name);
> +            return;
>          }
>  
>          opt->desc = &desc[i];
>  
>          qemu_opt_parse(opt, &local_err);
>          if (error_is_set(&local_err)) {
> -            qerror_report_err(local_err);
> -            error_free(local_err);
> -            return -1;
> +            error_propagate(errp, local_err);
> +            return;
>          }
>      }
> -
> -    return 0;
>  }

(I *almost* suggested to drop "local_err" and pass "errp" directly to
qemu_opt_parse(), since the "if" body consists of nothing more than
error_propagate() now. But then I noticed the "return" that aborts the
QTAILQ_FOREACH(), and so we do have to rely on "local_err" -- "errp"
could be NULL, and we could not check *errp for loop-exit purposes. Good.)

Laszlo



reply via email to

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