Re: [PATCH v2 2/5] Introduce virErrorCopyNew

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

 



On Fri, Jul 10, 2015 at 11:26:15 +0200, Jiri Denemark wrote:
> A helper function for copying error objects.
> 
> Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> ---
> 
> Notes:
>     Version 2:
>     - new patch
> 
>  docs/apibuild.py         |  1 +
>  src/libvirt_private.syms |  1 +
>  src/util/virerror.c      | 19 +++++++++++++++++++
>  src/util/virerror.h      |  1 +
>  4 files changed, 22 insertions(+)
> 

...

> diff --git a/src/util/virerror.c b/src/util/virerror.c
> index fae627b..3ec12a3 100644
> --- a/src/util/virerror.c
> +++ b/src/util/virerror.c
> @@ -214,6 +214,25 @@ virCopyError(virErrorPtr from,
>      return ret;
>  }
>  
> +
> +virErrorPtr
> +virErrorCopyNew(virErrorPtr err)
> +{
> +    virErrorPtr ret;
> +
> +    if (!err)
> +        return NULL;

Perhaps drop the above hunk so that it's enforced that this func returns
NULL only on failure. ACK stads if you choose to do so.

> +
> +    if (VIR_ALLOC_QUIET(ret) < 0)
> +        return NULL;
> +
> +    if (virCopyError(err, ret) < 0)
> +        VIR_FREE(ret);
> +
> +    return ret;
> +}

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]