[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v2 2/5] char: Clean up fragile use of error_is_s

From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 2/5] char: Clean up fragile use of error_is_set()
Date: Mon, 19 May 2014 11:15:11 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 05/19/2014 10:57 AM, Markus Armbruster wrote:
> Using error_is_set(ERRP) to find out whether a function failed is
> either wrong, fragile, or unnecessarily opaque.  It's wrong when ERRP
> may be null, because errors go undetected when it is.  It's fragile
> when proving ERRP non-null involves a non-local argument.  Else, it's
> unnecessarily opaque (see commit 84d18f0).
> The error_is_set(errp) in qemu_chr_new_from_opts() is merely fragile,
> because the callers never pass a null errp argument.
> Make the code more robust and more obviously correct: receive the
> error in a local variable, then propagate it through the parameter.
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  qemu-char.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

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]