[libvirt PATCH 02/14] virQEMUCapsSEVInfoCopy: Remove superfluous g_auto usage
Michal Prívozník
mprivozn at redhat.com
Wed Jan 12 14:36:03 UTC 2022
On 1/12/22 14:10, Tim Wiederhake wrote:
> Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
> ---
> src/qemu/qemu_capabilities.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> index 5f1eb5014c..f8db6fd370 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -1891,7 +1891,7 @@ static int
> virQEMUCapsSEVInfoCopy(virSEVCapability **dst,
> virSEVCapability *src)
> {
> - g_autoptr(virSEVCapability) tmp = NULL;
> + virSEVCapability *tmp;
>
> if (!src) {
> *dst = NULL;
> @@ -1908,7 +1908,7 @@ virQEMUCapsSEVInfoCopy(virSEVCapability **dst,
> tmp->max_guests = src->max_guests;
> tmp->max_es_guests = src->max_es_guests;
>
> - *dst = g_steal_pointer(&tmp);
> + *dst = tmp;
> return 0;
> }
>
I have to admit that I find code as-is more future proof. If we ever
want to add a check there, it can simply return NULL, -1 or whatever.
But at the same time it's matter of preference.
Michal
More information about the libvir-list
mailing list