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 <jdene...@redhat.com>
> ---
> 
> 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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to