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

[PATCH 2/7] qemuMigrationParamsFromFlags: Use 'g_autoptr' to remove 'error:' label



Signed-off-by: Peter Krempa <pkrempa redhat com>
---
 src/qemu/qemu_migration_params.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index f466c3c4f6..03d8d4fb49 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -534,7 +534,7 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
                              unsigned long flags,
                              qemuMigrationParty party)
 {
-    qemuMigrationParamsPtr migParams;
+    g_autoptr(qemuMigrationParams) migParams = NULL;
     size_t i;

     if (!(migParams = qemuMigrationParamsNew()))
@@ -565,14 +565,14 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
             if (qemuMigrationParamsGetTPInt(migParams, item->param, params,
                                             nparams, item->typedParam,
                                             item->unit) < 0)
-                goto error;
+                return NULL;
             break;

         case QEMU_MIGRATION_PARAM_TYPE_ULL:
             if (qemuMigrationParamsGetTPULL(migParams, item->param, params,
                                             nparams, item->typedParam,
                                             item->unit) < 0)
-                goto error;
+                return NULL;
             break;

         case QEMU_MIGRATION_PARAM_TYPE_BOOL:
@@ -581,7 +581,7 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
         case QEMU_MIGRATION_PARAM_TYPE_STRING:
             if (qemuMigrationParamsGetTPString(migParams, item->param, params,
                                                nparams, item->typedParam) < 0)
-                goto error;
+                return NULL;
             break;
         }
     }
@@ -591,24 +591,20 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
         !(flags & VIR_MIGRATE_AUTO_CONVERGE)) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("Turn auto convergence on to tune it"));
-        goto error;
+        return NULL;
     }

     if (migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].set &&
         !(flags & VIR_MIGRATE_PARALLEL)) {
         virReportError(VIR_ERR_INVALID_ARG, "%s",
                        _("Turn parallel migration on to tune it"));
-        goto error;
+        return NULL;
     }

     if (qemuMigrationParamsSetCompression(params, nparams, flags, migParams) < 0)
-        goto error;
-
-    return migParams;
+        return NULL;

- error:
-    qemuMigrationParamsFree(migParams);
-    return NULL;
+    return g_steal_pointer(&migParams);
 }


-- 
2.26.2


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