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

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



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 redhat com>
---
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 redhat com>

Jano

Attachment: signature.asc
Description: PGP signature


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