mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: DomainGetGuestVcpusParams: reduce scope of tmp
Wrap the macro body in a new block and move the declaration of 'tmp' into it, to avoid the need to mix g_autofree with manual freeing. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
f7b7c17dfa
commit
70f09acda4
@ -18396,7 +18396,6 @@ qemuDomainGetGuestVcpusParams(virTypedParameterPtr *params,
|
|||||||
g_autoptr(virBitmap) vcpus = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID);
|
g_autoptr(virBitmap) vcpus = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID);
|
||||||
g_autoptr(virBitmap) online = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID);
|
g_autoptr(virBitmap) online = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID);
|
||||||
g_autoptr(virBitmap) offlinable = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID);
|
g_autoptr(virBitmap) offlinable = virBitmapNew(QEMU_GUEST_VCPU_MAX_ID);
|
||||||
g_autofree char *tmp = NULL;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
@ -18416,11 +18415,13 @@ qemuDomainGetGuestVcpusParams(virTypedParameterPtr *params,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define ADD_BITMAP(name) \
|
#define ADD_BITMAP(name) \
|
||||||
|
do { \
|
||||||
|
g_autofree char *tmp = NULL; \
|
||||||
if (!(tmp = virBitmapFormat(name))) \
|
if (!(tmp = virBitmapFormat(name))) \
|
||||||
goto cleanup; \
|
goto cleanup; \
|
||||||
if (virTypedParamsAddString(&par, &npar, &maxpar, #name, tmp) < 0) \
|
if (virTypedParamsAddString(&par, &npar, &maxpar, #name, tmp) < 0) \
|
||||||
goto cleanup; \
|
goto cleanup; \
|
||||||
VIR_FREE(tmp)
|
} while (0)
|
||||||
|
|
||||||
ADD_BITMAP(vcpus);
|
ADD_BITMAP(vcpus);
|
||||||
ADD_BITMAP(online);
|
ADD_BITMAP(online);
|
||||||
|
Loading…
Reference in New Issue
Block a user