qemu: rename virFirmware*Free() functions to have more accurate names

Several functions had the names virFirmware[something]Free(), but they
aren't taking a pointer to some object and freeing it. Instead, they
are making a copy of the content of an entire object, then Freeing the
objects pointed to by that content.

As a first step in a too-complicated cleanup just to eliminate a few
occurrences of VIR_FREE(), this patch renames those functions to more
accurately reflect what they do - they Free the *Content* of their
arguments.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Laine Stump 2021-02-03 16:07:59 -05:00
parent 8626fb378c
commit e1b02e3a56

View File

@ -188,7 +188,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuFirmwareOSInterface, qemuFirmwareOSInterfaceFr
static void
qemuFirmwareFlashFileFree(qemuFirmwareFlashFile flash)
qemuFirmwareFlashFileFreeContent(qemuFirmwareFlashFile flash)
{
VIR_FREE(flash.filename);
VIR_FREE(flash.format);
@ -196,39 +196,39 @@ qemuFirmwareFlashFileFree(qemuFirmwareFlashFile flash)
static void
qemuFirmwareMappingFlashFree(qemuFirmwareMappingFlash flash)
qemuFirmwareMappingFlashFreeContent(qemuFirmwareMappingFlash flash)
{
qemuFirmwareFlashFileFree(flash.executable);
qemuFirmwareFlashFileFree(flash.nvram_template);
qemuFirmwareFlashFileFreeContent(flash.executable);
qemuFirmwareFlashFileFreeContent(flash.nvram_template);
}
static void
qemuFirmwareMappingKernelFree(qemuFirmwareMappingKernel kernel)
qemuFirmwareMappingKernelFreeContent(qemuFirmwareMappingKernel kernel)
{
VIR_FREE(kernel.filename);
}
static void
qemuFirmwareMappingMemoryFree(qemuFirmwareMappingMemory memory)
qemuFirmwareMappingMemoryFreeContent(qemuFirmwareMappingMemory memory)
{
VIR_FREE(memory.filename);
}
static void
qemuFirmwareMappingFree(qemuFirmwareMapping mapping)
qemuFirmwareMappingFreeContent(qemuFirmwareMapping mapping)
{
switch (mapping.device) {
case QEMU_FIRMWARE_DEVICE_FLASH:
qemuFirmwareMappingFlashFree(mapping.data.flash);
qemuFirmwareMappingFlashFreeContent(mapping.data.flash);
break;
case QEMU_FIRMWARE_DEVICE_KERNEL:
qemuFirmwareMappingKernelFree(mapping.data.kernel);
qemuFirmwareMappingKernelFreeContent(mapping.data.kernel);
break;
case QEMU_FIRMWARE_DEVICE_MEMORY:
qemuFirmwareMappingMemoryFree(mapping.data.memory);
qemuFirmwareMappingMemoryFreeContent(mapping.data.memory);
break;
case QEMU_FIRMWARE_DEVICE_NONE:
case QEMU_FIRMWARE_DEVICE_LAST:
@ -271,7 +271,7 @@ qemuFirmwareFree(qemuFirmwarePtr fw)
return;
qemuFirmwareOSInterfaceFree(fw->interfaces);
qemuFirmwareMappingFree(fw->mapping);
qemuFirmwareMappingFreeContent(fw->mapping);
for (i = 0; i < fw->ntargets; i++)
qemuFirmwareTargetFree(fw->targets[i]);
g_free(fw->targets);