mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
qemu: refactor virQEMUCapsNewCopy
Use g_auto and remove pointless labels. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
This commit is contained in:
parent
37574d5f17
commit
d45af4ea45
@ -1953,7 +1953,7 @@ virQEMUCapsAccelCopy(virQEMUCapsAccel *dst,
|
|||||||
|
|
||||||
virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps)
|
virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps)
|
||||||
{
|
{
|
||||||
virQEMUCaps *ret = virQEMUCapsNewBinary(qemuCaps->binary);
|
g_autoptr(virQEMUCaps) ret = virQEMUCapsNewBinary(qemuCaps->binary);
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
@ -1980,7 +1980,7 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps)
|
|||||||
|
|
||||||
if (virQEMUCapsAccelCopy(&ret->kvm, &qemuCaps->kvm) < 0 ||
|
if (virQEMUCapsAccelCopy(&ret->kvm, &qemuCaps->kvm) < 0 ||
|
||||||
virQEMUCapsAccelCopy(&ret->tcg, &qemuCaps->tcg) < 0)
|
virQEMUCapsAccelCopy(&ret->tcg, &qemuCaps->tcg) < 0)
|
||||||
goto error;
|
return NULL;
|
||||||
|
|
||||||
ret->gicCapabilities = g_new0(virGICCapability, qemuCaps->ngicCapabilities);
|
ret->gicCapabilities = g_new0(virGICCapability, qemuCaps->ngicCapabilities);
|
||||||
ret->ngicCapabilities = qemuCaps->ngicCapabilities;
|
ret->ngicCapabilities = qemuCaps->ngicCapabilities;
|
||||||
@ -1990,13 +1990,9 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps)
|
|||||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST) &&
|
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST) &&
|
||||||
virQEMUCapsSEVInfoCopy(&ret->sevCapabilities,
|
virQEMUCapsSEVInfoCopy(&ret->sevCapabilities,
|
||||||
qemuCaps->sevCapabilities) < 0)
|
qemuCaps->sevCapabilities) < 0)
|
||||||
goto error;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
error:
|
|
||||||
virObjectUnref(ret);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
return g_steal_pointer(&ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user