qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 11/24] error: Use error_reportf_err() where i


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v3 11/24] error: Use error_reportf_err() where it makes obvious sense
Date: Fri, 18 Dec 2015 09:08:12 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 12/18/2015 08:35 AM, Markus Armbruster wrote:
> Done with this Coccinelle semantic patch
> 
>     @@
>     expression FMT, E, S;
>     expression list ARGS;
>     @@
>     -    error_report(FMT, ARGS, error_get_pretty(E));
>     +    error_reportf_err(E, FMT/*@@@*/, ARGS);
>     (
>     -    error_free(E);
>     |
>        exit(S);
>     |
>        abort();
>     )
> 
> followed by a replace of '%s"/*@@@*/' by '"' and some line rewrapping,
> because I can't figure out how to make Coccinelle transform strings.
> 
> We now use the error whole instead of just its message obtained with
> error_get_pretty().  This avoids suppressing its hint (see commit
> 50b7b00), but I can't see how the errors touched in this commit could
> come with hints.
> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---

> +++ b/arch_init.c
> @@ -258,9 +258,7 @@ void do_acpitable_option(const QemuOpts *opts)
>  
>      acpi_table_add(opts, &err);
>      if (err) {
> -        error_report("Wrong acpi table provided: %s",
> -                     error_get_pretty(err));
> -        error_free(err);
> +        error_reportf_err(err, "Wrong acpi table provided: ");

Bikeshedding: should error_reportf_err() automatically add the trailing
": " to the prefix, instead of having every caller express it?  Would
affect 10/24 as well.  But I can't see a strong reason to add the churn
it would cause for a respin, so I won't insist.

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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