[PATCH 13/13] qemu_monitor_json: Drop pointless error labels

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

 



After previous cleanups, some 'error' labels were rendered
needless - they contain nothing more than a return statement.
Well, those labels can be dropped and 'goto error' can be
replaced with return statement directly.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_monitor_json.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index bb76ac7d37..e9be9bdabd 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5351,7 +5351,7 @@ qemuMonitorJSONMakeCPUModel(virCPUDef *cpu,
     size_t i;
 
     if (virJSONValueObjectAppendString(model, "name", cpu->model) < 0)
-        goto error;
+        return NULL;
 
     if (cpu->nfeatures || !migratable) {
         g_autoptr(virJSONValue) props = virJSONValueNewObject();
@@ -5367,22 +5367,19 @@ qemuMonitorJSONMakeCPUModel(virCPUDef *cpu,
                 enabled = true;
 
             if (virJSONValueObjectAppendBoolean(props, name, enabled) < 0)
-                goto error;
+                return NULL;
         }
 
         if (!migratable &&
             virJSONValueObjectAppendBoolean(props, "migratable", false) < 0) {
-            goto error;
+            return NULL;
         }
 
         if (virJSONValueObjectAppend(model, "props", &props) < 0)
-            goto error;
+            return NULL;
     }
 
     return g_steal_pointer(&model);
-
- error:
-    return NULL;
 }
 
 
@@ -6930,20 +6927,17 @@ qemuMonitorJSONParseCPUx86Features(virJSONValue *data)
     size_t i;
 
     if (!(cpudata = virCPUDataNew(VIR_ARCH_X86_64)))
-        goto error;
+        return NULL;
 
     item.type = VIR_CPU_X86_DATA_CPUID;
     for (i = 0; i < virJSONValueArraySize(data); i++) {
         if (qemuMonitorJSONParseCPUx86FeatureWord(virJSONValueArrayGet(data, i),
                                                   &item.data.cpuid) < 0 ||
             virCPUx86DataAdd(cpudata, &item) < 0)
-            goto error;
+            return NULL;
     }
 
     return g_steal_pointer(&cpudata);
-
- error:
-    return NULL;
 }
 
 
@@ -7049,20 +7043,17 @@ qemuMonitorJSONGetGuestCPUx86(qemuMonitor *mon,
 
     if (qemuMonitorJSONGetCPUx86Data(mon, "feature-words",
                                      &cpuEnabled) < 0)
-        goto error;
+        return -1;
 
     if (disabled &&
         qemuMonitorJSONGetCPUx86Data(mon, "filtered-features",
                                      &cpuDisabled) < 0)
-        goto error;
+        return -1;
 
     *data = g_steal_pointer(&cpuEnabled);
     if (disabled)
         *disabled = g_steal_pointer(&cpuDisabled);
     return 0;
-
- error:
-    return -1;
 }
 
 
-- 
2.32.0




[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