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:
Ján Tomko 2023-09-29 14:37:47 +02:00
parent f7b7c17dfa
commit 70f09acda4

View File

@ -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);