Re: [PATCH 7/7] qemuMigrationCapsCheck: Refactor variable cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Monday in 2020, Peter Krempa wrote:
Use automatic memory allocation to simplify the code and remove the need
for a 'cleanup:' label.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
src/qemu/qemu_migration_params.c | 33 ++++++++++++--------------------
1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 38a5a91f2a..c785f87ab8 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -1352,11 +1352,10 @@ qemuMigrationCapsCheck(virQEMUDriverPtr driver,
                       int asyncJob)
{
    qemuDomainObjPrivatePtr priv = vm->privateData;
-    virBitmapPtr migEvent = NULL;
-    virJSONValuePtr json = NULL;
-    char **caps = NULL;
+    g_autoptr(virBitmap) migEvent = NULL;
+    g_autoptr(virJSONValue) json = NULL;

+    VIR_AUTOSTRINGLIST caps = NULL;

You can do:

    g_auto(GStrv) caps = NULL;

here.

Either way:
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux