[libvirt] [PATCH v1 03/26] conf: remove more unneeded labels

Daniel Henrique Barboza danielhb413 at gmail.com
Mon Jan 6 21:57:27 UTC 2020


Remove unneeded labels from the following conf files:

cpu_conf.c
domain_addr.c
interface_conf.c
nwfilter_params.c

Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 src/conf/cpu_conf.c        | 36 ++++++++++++++++--------------------
 src/conf/domain_addr.c     |  9 ++++-----
 src/conf/interface_conf.c  |  9 +++------
 src/conf/nwfilter_params.c |  5 +----
 4 files changed, 24 insertions(+), 35 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 7490d6bf73..b463981de0 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -992,7 +992,6 @@ virCPUDefIsEqual(virCPUDefPtr src,
                  virCPUDefPtr dst,
                  bool reportError)
 {
-    bool identical = false;
     size_t i;
 
     if (!src && !dst)
@@ -1004,91 +1003,91 @@ virCPUDefIsEqual(virCPUDefPtr src,
 
     if ((src && !dst) || (!src && dst)) {
         MISMATCH("%s", _("Target CPU does not match source"));
-        goto cleanup;
+        return false;
     }
 
     if (src->type != dst->type) {
         MISMATCH(_("Target CPU type %s does not match source %s"),
                  virCPUTypeToString(dst->type),
                  virCPUTypeToString(src->type));
-        goto cleanup;
+        return false;
     }
 
     if (src->mode != dst->mode) {
         MISMATCH(_("Target CPU mode %s does not match source %s"),
                  virCPUModeTypeToString(dst->mode),
                  virCPUModeTypeToString(src->mode));
-        goto cleanup;
+        return false;
     }
 
     if (src->check != dst->check) {
         MISMATCH(_("Target CPU check %s does not match source %s"),
                  virCPUCheckTypeToString(dst->check),
                  virCPUCheckTypeToString(src->check));
-        goto cleanup;
+        return false;
     }
 
     if (src->arch != dst->arch) {
         MISMATCH(_("Target CPU arch %s does not match source %s"),
                  virArchToString(dst->arch),
                  virArchToString(src->arch));
-        goto cleanup;
+        return false;
     }
 
     if (STRNEQ_NULLABLE(src->model, dst->model)) {
         MISMATCH(_("Target CPU model %s does not match source %s"),
                  NULLSTR(dst->model), NULLSTR(src->model));
-        goto cleanup;
+        return false;
     }
 
     if (STRNEQ_NULLABLE(src->vendor, dst->vendor)) {
         MISMATCH(_("Target CPU vendor %s does not match source %s"),
                  NULLSTR(dst->vendor), NULLSTR(src->vendor));
-        goto cleanup;
+        return false;
     }
 
     if (STRNEQ_NULLABLE(src->vendor_id, dst->vendor_id)) {
         MISMATCH(_("Target CPU vendor id %s does not match source %s"),
                  NULLSTR(dst->vendor_id), NULLSTR(src->vendor_id));
-        goto cleanup;
+        return false;
     }
 
     if (src->sockets != dst->sockets) {
         MISMATCH(_("Target CPU sockets %d does not match source %d"),
                  dst->sockets, src->sockets);
-        goto cleanup;
+        return false;
     }
 
     if (src->cores != dst->cores) {
         MISMATCH(_("Target CPU cores %d does not match source %d"),
                  dst->cores, src->cores);
-        goto cleanup;
+        return false;
     }
 
     if (src->threads != dst->threads) {
         MISMATCH(_("Target CPU threads %d does not match source %d"),
                  dst->threads, src->threads);
-        goto cleanup;
+        return false;
     }
 
     if (src->nfeatures != dst->nfeatures) {
         MISMATCH(_("Target CPU feature count %zu does not match source %zu"),
                  dst->nfeatures, src->nfeatures);
-        goto cleanup;
+        return false;
     }
 
     for (i = 0; i < src->nfeatures; i++) {
         if (STRNEQ(src->features[i].name, dst->features[i].name)) {
             MISMATCH(_("Target CPU feature %s does not match source %s"),
                      dst->features[i].name, src->features[i].name);
-            goto cleanup;
+            return false;
         }
 
         if (src->features[i].policy != dst->features[i].policy) {
             MISMATCH(_("Target CPU feature policy %s does not match source %s"),
                      virCPUFeaturePolicyTypeToString(dst->features[i].policy),
                      virCPUFeaturePolicyTypeToString(src->features[i].policy));
-            goto cleanup;
+            return false;
         }
     }
 
@@ -1098,15 +1097,12 @@ virCPUDefIsEqual(virCPUDefPtr src,
          (src->cache->level != dst->cache->level ||
           src->cache->mode != dst->cache->mode))) {
         MISMATCH("%s", _("Target CPU cache does not match source"));
-        goto cleanup;
+        return false;
     }
 
 #undef MISMATCH
 
-    identical = true;
-
- cleanup:
-    return identical;
+    return true;
 }
 
 
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 165bd70f2b..ef7ee80e6a 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1175,7 +1175,7 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
 
     if (addrs->nbuses == 0) {
         virReportError(VIR_ERR_XML_ERROR, "%s", _("No PCI buses available"));
-        goto error;
+        return -1;
     }
 
     /* if the caller asks for "any function", give them function 0 */
@@ -1199,7 +1199,7 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
 
         if (virDomainPCIAddressFindUnusedFunctionOnBus(bus, &a, function,
                                                        flags, &found) < 0) {
-            goto error;
+            return -1;
         }
 
         if (found)
@@ -1223,7 +1223,7 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
 
         if (virDomainPCIAddressFindUnusedFunctionOnBus(bus, &a, function,
                                                        flags, &found) < 0) {
-            goto error;
+            return -1;
         }
 
         /* The isolation group for the bus will actually be changed
@@ -1236,7 +1236,7 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
     if (addrs->dryRun) {
         /* a is already set to the first new bus */
         if (virDomainPCIAddressSetGrow(addrs, &a, flags) < 0)
-            goto error;
+            return -1;
         /* this device will use the first slot of the new bus */
         a.slot = addrs->buses[a.bus].minSlot;
         goto success;
@@ -1244,7 +1244,6 @@ virDomainPCIAddressGetNextAddr(virDomainPCIAddressSetPtr addrs,
 
     virReportError(VIR_ERR_INTERNAL_ERROR,
                    "%s", _("No more available PCI slots"));
- error:
     return -1;
 
  success:
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index fbfd855395..7a41b19ed0 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -1070,19 +1070,19 @@ virInterfaceDefDevFormat(virBufferPtr buf,
     if (def == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("virInterfaceDefFormat NULL def"));
-        goto cleanup;
+        return -1;
     }
 
     if ((def->name == NULL) && (def->type != VIR_INTERFACE_TYPE_VLAN)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("virInterfaceDefFormat missing interface name"));
-        goto cleanup;
+        return -1;
     }
 
     if (!(type = virInterfaceTypeToString(def->type))) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unexpected interface type %d"), def->type);
-        goto cleanup;
+        return -1;
     }
 
     virBufferAsprintf(buf, "<interface type='%s' ", type);
@@ -1125,9 +1125,6 @@ virInterfaceDefDevFormat(virBufferPtr buf,
     virBufferAddLit(buf, "</interface>\n");
 
     return 0;
-
- cleanup:
-    return -1;
 }
 
 
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 4110169135..b0d60abdd0 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -672,12 +672,9 @@ virNWFilterHashTablePutAll(virHashTablePtr src,
 
     virHashForEach(src, addToTable, &atts);
     if (atts.errOccurred)
-        goto err_exit;
+        return -1;
 
     return 0;
-
- err_exit:
-    return -1;
 }
 
 /* The general purpose function virNWFilterVarValueEqual returns a
-- 
2.24.1





More information about the libvir-list mailing list