qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/7] error: De-duplicate code creating Error


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 1/7] error: De-duplicate code creating Error objects
Date: Thu, 23 Jul 2015 08:38:18 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 07/23/2015 08:01 AM, Markus Armbruster wrote:
> Duplicated when commit 680d16d added error_set_errno(), and again when
> commit 20840d4 added error_set_win32().
> 
> Make the original copy in error_set() reusable by factoring out
> error_setv(), then rewrite error_set_errno() and error_set_win32() on
> top of it.
> 
> Signed-off-by: Markus Armbruster <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> ---
>  util/error.c | 70 
> ++++++++++++++++++++++--------------------------------------
>  1 file changed, 26 insertions(+), 44 deletions(-)
> 

>      if (os_errno != 0) {
> -        err->msg = g_strdup_printf("%s: %s", msg1, strerror(os_errno));
> -        g_free(msg1);
> -    } else {
> -        err->msg = msg1;
> +        msg = (*errp)->msg;
> +        (*errp)->msg = g_strdup_printf("%s: %s", msg, strerror(os_errno));

Unrelated comment, so doesn't change R-b:

strerror() is not required to be thread-safe, and can return NULL on
error.  Do we care?

-- 
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]