[libvirt] [PATCH v2 2/5] Introduce virErrorCopyNew
Peter Krempa
pkrempa at redhat.com
Fri Jul 10 09:38:24 UTC 2015
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 at 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;
> +}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150710/8be0b522/attachment-0001.sig>
More information about the libvir-list
mailing list