]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: eliminate unnecessary labels
authorLaine Stump <laine@redhat.com>
Fri, 3 Jul 2020 03:19:26 +0000 (23:19 -0400)
committerLaine Stump <laine@redhat.com>
Wed, 8 Jul 2020 20:35:36 +0000 (16:35 -0400)
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/capabilities.c
src/conf/checkpoint_conf.c
src/conf/cpu_conf.c
src/conf/domain_conf.c
src/conf/network_conf.c
src/conf/nwfilter_conf.c
src/conf/secret_conf.c
src/conf/snapshot_conf.c
src/conf/storage_conf.c
src/conf/virnetworkobj.c
src/conf/virsavecookie.c

index 6a48af1fcacb5f4562c271ba26bde9fdc07162cf..610e6e8242efb09b5b4d2dc979fb63d512083ee1 100644 (file)
@@ -1340,7 +1340,7 @@ virCapabilitiesFormatXML(virCapsPtr caps)
     virBufferAdjustIndent(&buf, 2);
 
     if (virCapabilitiesFormatHostXML(&caps->host, &buf) < 0)
-        goto error;
+        return NULL;
 
     virCapabilitiesFormatGuestXML(caps->guests, caps->nguests, &buf);
 
@@ -1350,9 +1350,6 @@ virCapabilitiesFormatXML(virCapsPtr caps)
     virBufferAddLit(&buf, "</capabilities>\n");
 
     return virBufferContentAndReset(&buf);
-
- error:
-    return NULL;
 }
 
 /* get the maximum ID of cpus in the host */
index 851c84f9838d6d4d1eab30a6689342eef40ed4fd..1f935952c8c268ffc812c931bd800dd4b74e30c2 100644 (file)
@@ -476,7 +476,7 @@ virDomainCheckpointDefFormatInternal(virBufferPtr buf,
         for (i = 0; i < def->ndisks; i++) {
             if (virDomainCheckpointDiskDefFormat(buf, &def->disks[i],
                                                  flags) < 0)
-                goto error;
+                return -1;
         }
         virBufferAdjustIndent(buf, -2);
         virBufferAddLit(buf, "</disks>\n");
@@ -485,17 +485,15 @@ virDomainCheckpointDefFormatInternal(virBufferPtr buf,
     if (!(flags & VIR_DOMAIN_CHECKPOINT_FORMAT_NO_DOMAIN) &&
         virDomainDefFormatInternal(def->parent.dom, xmlopt,
                                    buf, domainflags) < 0)
-        goto error;
+        return -1;
 
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</domaincheckpoint>\n");
 
     return 0;
-
- error:
-    return -1;
 }
 
+
 char *
 virDomainCheckpointDefFormat(virDomainCheckpointDefPtr def,
                              virDomainXMLOptionPtr xmlopt,
index 12862a29860593aaeb34c319fb5c0a1d92df0b7f..fcc1ab6814afef422ebc85eacea5400bbe571067 100644 (file)
@@ -671,12 +671,9 @@ virCPUDefFormat(virCPUDefPtr def,
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 
     if (virCPUDefFormatBufFull(&buf, def, numa) < 0)
-        goto cleanup;
+        return NULL;
 
     return virBufferContentAndReset(&buf);
-
- cleanup:
-    return NULL;
 }
 
 
@@ -685,7 +682,6 @@ virCPUDefFormatBufFull(virBufferPtr buf,
                        virCPUDefPtr def,
                        virDomainNumaPtr numa)
 {
-    int ret = -1;
     g_auto(virBuffer) attributeBuf = VIR_BUFFER_INITIALIZER;
     g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
 
@@ -701,7 +697,7 @@ virCPUDefFormatBufFull(virBufferPtr buf,
         if (!(tmp = virCPUModeTypeToString(def->mode))) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Unexpected CPU mode %d"), def->mode);
-            goto cleanup;
+            return -1;
         }
         virBufferAsprintf(&attributeBuf, " mode='%s'", tmp);
 
@@ -710,7 +706,7 @@ virCPUDefFormatBufFull(virBufferPtr buf,
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("Unexpected CPU match policy %d"),
                                def->match);
-                goto cleanup;
+                return -1;
             }
             virBufferAsprintf(&attributeBuf, " match='%s'", tmp);
         }
@@ -731,10 +727,10 @@ virCPUDefFormatBufFull(virBufferPtr buf,
         virBufferAsprintf(&childrenBuf, "<arch>%s</arch>\n",
                           virArchToString(def->arch));
     if (virCPUDefFormatBuf(&childrenBuf, def) < 0)
-        goto cleanup;
+        return -1;
 
     if (virDomainNumaDefFormatXML(&childrenBuf, numa) < 0)
-        goto cleanup;
+        return -1;
 
     /* Put it all together */
     if (virBufferUse(&attributeBuf) || virBufferUse(&childrenBuf)) {
@@ -752,9 +748,7 @@ virCPUDefFormatBufFull(virBufferPtr buf,
         }
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 int
index d33eb65f05ca0484d920c6bb526c886bf793c568..d14485f18d1e0c1c3d8acf094328bc2ce8845f25 100644 (file)
@@ -29475,7 +29475,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
     if (!(type = virDomainVirtTypeToString(def->virtType))) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unexpected domain type %d"), def->virtType);
-        goto error;
+        return -1;
     }
 
     if (def->id == -1)
@@ -29520,13 +29520,13 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
         xmlIndentTreeOutput = 1;
         if (!(xmlbuf = xmlBufferCreate())) {
             virReportOOMError();
-            goto error;
+            return -1;
         }
 
         if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata,
                         virBufferGetIndent(buf) / 2, 1) < 0) {
             xmlIndentTreeOutput = oldIndentTreeOutput;
-            goto error;
+            return -1;
         }
         virBufferAsprintf(buf, "%s\n", (char *) xmlBufferContent(xmlbuf));
         xmlIndentTreeOutput = oldIndentTreeOutput;
@@ -29549,13 +29549,13 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
                       def->mem.cur_balloon);
 
     if (virDomainDefFormatBlkiotune(buf, def) < 0)
-        goto error;
+        return -1;
 
     virDomainMemtuneFormat(buf, &def->mem);
     virDomainMemorybackingFormat(buf, &def->mem);
 
     if (virDomainCpuDefFormat(buf, def) < 0)
-        goto error;
+        return -1;
 
     if (def->niothreadids > 0) {
         virBufferAsprintf(buf, "<iothreads>%zu</iothreads>\n",
@@ -29573,17 +29573,17 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
     }
 
     if (virDomainCputuneDefFormat(buf, def, flags) < 0)
-        goto error;
+        return -1;
 
     if (virDomainNumatuneFormatXML(buf, def->numa) < 0)
-        goto error;
+        return -1;
 
     if (def->resource)
         virDomainResourceDefFormat(buf, def->resource);
 
     for (i = 0; i < def->nsysinfo; i++) {
         if (virSysinfoFormat(buf, def->sysinfo[i]) < 0)
-            goto error;
+            return -1;
     }
 
     if (def->os.bootloader) {
@@ -29663,7 +29663,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("unexpected boot device type %d"),
                                def->os.bootDevs[n]);
-                goto error;
+                return -1;
             }
             virBufferAsprintf(buf, "<boot dev='%s'/>\n", boottype);
         }
@@ -29695,7 +29695,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
         if (mode == NULL) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("unexpected smbios mode %d"), def->os.smbios_mode);
-            goto error;
+            return -1;
         }
         virBufferAsprintf(buf, "<smbios mode='%s'/>\n", mode);
     }
@@ -29726,10 +29726,10 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
     }
 
     if (virDomainDefFormatFeatures(buf, def) < 0)
-        goto error;
+        return -1;
 
     if (virCPUDefFormatBufFull(buf, def->cpu, def->numa) < 0)
-        goto error;
+        return -1;
 
     virBufferAsprintf(buf, "<clock offset='%s'",
                       virDomainClockOffsetTypeToString(def->clock.offset));
@@ -29760,7 +29760,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
         virBufferAdjustIndent(buf, 2);
         for (n = 0; n < def->clock.ntimers; n++) {
             if (virDomainTimerDefFormat(buf, def->clock.timers[n]) < 0)
-                goto error;
+                return -1;
         }
         virBufferAdjustIndent(buf, -2);
         virBufferAddLit(buf, "</clock>\n");
@@ -29769,20 +29769,20 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
     if (virDomainEventActionDefFormat(buf, def->onPoweroff,
                                       "on_poweroff",
                                       virDomainLifecycleActionTypeToString) < 0)
-        goto error;
+        return -1;
     if (virDomainEventActionDefFormat(buf, def->onReboot,
                                       "on_reboot",
                                       virDomainLifecycleActionTypeToString) < 0)
-        goto error;
+        return -1;
     if (virDomainEventActionDefFormat(buf, def->onCrash,
                                       "on_crash",
                                       virDomainLifecycleActionTypeToString) < 0)
-        goto error;
+        return -1;
     if (def->onLockFailure != VIR_DOMAIN_LOCK_FAILURE_DEFAULT &&
         virDomainEventActionDefFormat(buf, def->onLockFailure,
                                       "on_lockfailure",
                                       virDomainLockFailureTypeToString) < 0)
-        goto error;
+        return -1;
 
     if (def->pm.s3 || def->pm.s4) {
         virBufferAddLit(buf, "<pm>\n");
@@ -29809,35 +29809,35 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
 
     for (n = 0; n < def->ndisks; n++)
         if (virDomainDiskDefFormat(buf, def->disks[n], flags, xmlopt) < 0)
-            goto error;
+            return -1;
 
     for (n = 0; n < def->ncontrollers; n++)
         if (virDomainControllerDefFormat(buf, def->controllers[n], flags) < 0)
-            goto error;
+            return -1;
 
     for (n = 0; n < def->nleases; n++)
         if (virDomainLeaseDefFormat(buf, def->leases[n]) < 0)
-            goto error;
+            return -1;
 
     for (n = 0; n < def->nfss; n++)
         if (virDomainFSDefFormat(buf, def->fss[n], flags) < 0)
-            goto error;
+            return -1;
 
     for (n = 0; n < def->nnets; n++)
         if (virDomainNetDefFormat(buf, def->nets[n], xmlopt, flags) < 0)
-            goto error;
+            return -1;
 
     for (n = 0; n < def->nsmartcards; n++)
         if (virDomainSmartcardDefFormat(buf, def->smartcards[n], flags) < 0)
-            goto error;
+            return -1;
 
     for (n = 0; n < def->nserials; n++)
         if (virDomainChrDefFormat(buf, def->serials[n], flags) < 0)
-            goto error;
+            return -1;
 
     for (n = 0; n < def->nparallels; n++)
         if (virDomainChrDefFormat(buf, def->parallels[n], flags) < 0)
-            goto error;
+            return -1;
 
     for (n = 0; n < def->nconsoles; n++) {
         virDomainChrDef console;
@@ -29855,36 +29855,36 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
             memcpy(&console, def->consoles[n], sizeof(console));
         }
         if (virDomainChrDefFormat(buf, &console, flags) < 0)
-            goto error;
+            return -1;
     }
 
     for (n = 0; n < def->nchannels; n++)
         if (virDomainChrDefFormat(buf, def->channels[n], flags) < 0)
-            goto error;
+            return -1;
 
     for (n = 0; n < def->ninputs; n++) {
         if (virDomainInputDefFormat(buf, def->inputs[n], flags) < 0)
-            goto error;
+            return -1;
     }
 
     for (n = 0; n < def->ntpms; n++) {
         if (virDomainTPMDefFormat(buf, def->tpms[n], flags) < 0)
-            goto error;
+            return -1;
     }
 
     for (n = 0; n < def->ngraphics; n++) {
         if (virDomainGraphicsDefFormat(buf, def->graphics[n], flags) < 0)
-            goto error;
+            return -1;
     }
 
     for (n = 0; n < def->nsounds; n++) {
         if (virDomainSoundDefFormat(buf, def->sounds[n], flags) < 0)
-            goto error;
+            return -1;
     }
 
     for (n = 0; n < def->nvideos; n++) {
         if (virDomainVideoDefFormat(buf, def->videos[n], flags) < 0)
-            goto error;
+            return -1;
     }
 
     for (n = 0; n < def->nhostdevs; n++) {
@@ -29894,13 +29894,13 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
          */
         if (!def->hostdevs[n]->parentnet &&
             virDomainHostdevDefFormat(buf, def->hostdevs[n], flags) < 0) {
-            goto error;
+            return -1;
         }
     }
 
     for (n = 0; n < def->nredirdevs; n++) {
         if (virDomainRedirdevDefFormat(buf, def->redirdevs[n], flags) < 0)
-            goto error;
+            return -1;
     }
 
     if (def->redirfilter)
@@ -29908,7 +29908,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
 
     for (n = 0; n < def->nhubs; n++) {
         if (virDomainHubDefFormat(buf, def->hubs[n], flags) < 0)
-            goto error;
+            return -1;
     }
 
     if (def->watchdog)
@@ -29919,7 +29919,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
 
     for (n = 0; n < def->nrngs; n++) {
         if (virDomainRNGDefFormat(buf, def->rngs[n], flags))
-            goto error;
+            return -1;
     }
 
     if (def->nvram)
@@ -29927,26 +29927,26 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
 
     for (n = 0; n < def->npanics; n++) {
         if (virDomainPanicDefFormat(buf, def->panics[n]) < 0)
-            goto error;
+            return -1;
     }
 
     for (n = 0; n < def->nshmems; n++) {
         if (virDomainShmemDefFormat(buf, def->shmems[n], flags) < 0)
-            goto error;
+            return -1;
     }
 
     for (n = 0; n < def->nmems; n++) {
         if (virDomainMemoryDefFormat(buf, def->mems[n], def, flags) < 0)
-            goto error;
+            return -1;
     }
 
     if (def->iommu &&
         virDomainIOMMUDefFormat(buf, def->iommu) < 0)
-        goto error;
+        return -1;
 
     if (def->vsock &&
         virDomainVsockDefFormat(buf, def->vsock) < 0)
-        goto error;
+        return -1;
 
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</devices>\n");
@@ -29961,18 +29961,16 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
 
     if (def->namespaceData && def->ns.format) {
         if ((def->ns.format)(buf, def->namespaceData) < 0)
-            goto error;
+            return -1;
     }
 
     virBufferAdjustIndent(buf, -2);
     virBufferAsprintf(buf, "</%s>\n", rootname);
 
     return 0;
-
- error:
-    return -1;
 }
 
+
 /* Converts VIR_DOMAIN_XML_COMMON_FLAGS into VIR_DOMAIN_DEF_FORMAT_*
  * flags, and silently ignores any other flags.  Note that the caller
  * should validate the set of flags it is willing to accept; see also
index 99f11fdf0598e01e68005b1b54202838ff73f5e0..0fd68a7d667e730fe241c9727e6d5d8d12a96f1d 100644 (file)
@@ -2721,12 +2721,9 @@ virNetworkDefFormat(const virNetworkDef *def,
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 
     if (virNetworkDefFormatBuf(&buf, def, xmlopt, flags) < 0)
-        goto error;
+        return NULL;
 
     return virBufferContentAndReset(&buf);
-
- error:
-    return NULL;
 }
 
 
index 3827c65462bc6d14fbf8331095157f94701c834f..02722abc32688778cf22af04d4ec1467ef72757b 100644 (file)
@@ -3062,16 +3062,13 @@ virNWFilterDefFormat(const virNWFilterDef *def)
 
     for (i = 0; i < def->nentries; i++) {
         if (virNWFilterEntryFormat(&buf, def->filterEntries[i]) < 0)
-            goto err_exit;
+            return NULL;
     }
 
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</filter>\n");
 
     return virBufferContentAndReset(&buf);
-
- err_exit:
-    return NULL;
 }
 
 static virNWFilterTriggerRebuildCallback rebuildCallback;
index 3960cf04adfef3e63cd2ed7471e2d35dd3d5e2dd..2e35348ce17147e6dcc3fd748f6b1b41572ac788 100644 (file)
@@ -294,12 +294,9 @@ virSecretDefFormat(const virSecretDef *def)
                               def->description);
     if (def->usage_type != VIR_SECRET_USAGE_TYPE_NONE &&
         virSecretDefFormatUsage(&buf, def) < 0)
-        goto error;
+        return NULL;
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</secret>\n");
 
     return virBufferContentAndReset(&buf);
-
- error:
-    return NULL;
 }
index b7ed3b42df1ce36b3e5aaeebc6d73b4203f4a3dd..07336e914fad13237b4504229fbb4bb502585feb 100644 (file)
@@ -877,7 +877,7 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
         virBufferAdjustIndent(buf, 2);
         for (i = 0; i < def->ndisks; i++) {
             if (virDomainSnapshotDiskDefFormat(buf, &def->disks[i], xmlopt) < 0)
-                goto error;
+                return -1;
         }
         virBufferAdjustIndent(buf, -2);
         virBufferAddLit(buf, "</disks>\n");
@@ -886,7 +886,7 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
     if (def->parent.dom) {
         if (virDomainDefFormatInternal(def->parent.dom, xmlopt,
                                        buf, domainflags) < 0)
-            goto error;
+            return -1;
     } else if (uuidstr) {
         virBufferAddLit(buf, "<domain>\n");
         virBufferAdjustIndent(buf, 2);
@@ -899,12 +899,12 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
         if (virDomainDefFormatInternalSetRootName(def->parent.inactiveDom, xmlopt,
                                                   buf, "inactiveDomain",
                                                   domainflags) < 0)
-            goto error;
+            return -1;
     }
 
     if (virSaveCookieFormatBuf(buf, def->cookie,
                                virDomainXMLOptionGetSaveCookie(xmlopt)) < 0)
-        goto error;
+        return -1;
 
     if (flags & VIR_DOMAIN_SNAPSHOT_FORMAT_INTERNAL)
         virBufferAsprintf(buf, "<active>%d</active>\n",
@@ -914,9 +914,6 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
     virBufferAddLit(buf, "</domainsnapshot>\n");
 
     return 0;
-
- error:
-    return -1;
 }
 
 
index 7bc743887ce52b7ea30a64be30d7e320a0934801..65d9b330492bfc03530348830e6841965841321c 100644 (file)
@@ -1226,12 +1226,9 @@ virStoragePoolDefFormat(virStoragePoolDefPtr def)
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 
     if (virStoragePoolDefFormatBuf(&buf, def) < 0)
-        goto error;
+        return NULL;
 
     return virBufferContentAndReset(&buf);
-
- error:
-    return NULL;
 }
 
 
@@ -1648,21 +1645,18 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
 
     if (virStorageVolTargetDefFormat(options, &buf,
                                      &def->target, "target") < 0)
-        goto cleanup;
+        return NULL;
 
     if (virStorageSourceHasBacking(&def->target) &&
         virStorageVolTargetDefFormat(options, &buf,
                                      def->target.backingStore,
                                      "backingStore") < 0)
-        goto cleanup;
+        return NULL;
 
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</volume>\n");
 
     return virBufferContentAndReset(&buf);
-
- cleanup:
-    return NULL;
 }
 
 
@@ -1753,7 +1747,7 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
     if (!type) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("unexpected pool type"));
-        goto cleanup;
+        return NULL;
     }
 
     virBufferAddLit(&buf, "<sources>\n");
@@ -1766,7 +1760,4 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
     virBufferAddLit(&buf, "</sources>\n");
 
     return virBufferContentAndReset(&buf);
-
- cleanup:
-    return NULL;
 }
index 5d90dec2bc865e2ab2b2a41de86b2c1f68850c1f..8b12ce04827ccbaaaf1f87b0bb146d839bef1409 100644 (file)
@@ -820,7 +820,7 @@ virNetworkObjFormat(virNetworkObjPtr obj,
     size_t i;
 
     if (!classIdStr)
-        goto error;
+        return NULL;
 
     virBufferAddLit(&buf, "<networkstatus>\n");
     virBufferAdjustIndent(&buf, 2);
@@ -835,15 +835,12 @@ virNetworkObjFormat(virNetworkObjPtr obj,
     }
 
     if (virNetworkDefFormatBuf(&buf, obj->def, xmlopt, flags) < 0)
-        goto error;
+        return NULL;
 
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</networkstatus>");
 
     return virBufferContentAndReset(&buf);
-
- error:
-    return NULL;
 }
 
 
index 429daf69be9c4272bdc755f1f6c400d427545cb3..d8c51ce0ef45959f05f9204a2d661f508247d993 100644 (file)
@@ -130,10 +130,7 @@ virSaveCookieFormat(virObjectPtr obj,
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
 
     if (virSaveCookieFormatBuf(&buf, obj, saveCookie) < 0)
-        goto error;
+        return NULL;
 
     return virBufferContentAndReset(&buf);
-
- error:
-    return NULL;
 }