Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/conf/capabilities.c | 5 +--
src/conf/checkpoint_conf.c | 8 ++--
src/conf/cpu_conf.c | 18 +++-----
src/conf/domain_conf.c | 88 +++++++++++++++++++-------------------
src/conf/network_conf.c | 5 +--
src/conf/nwfilter_conf.c | 5 +--
src/conf/secret_conf.c | 5 +--
src/conf/snapshot_conf.c | 11 ++---
src/conf/storage_conf.c | 17 ++------
src/conf/virnetworkobj.c | 7 +--
src/conf/virsavecookie.c | 5 +--
11 files changed, 67 insertions(+), 107 deletions(-)
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 6a48af1fca..610e6e8242 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -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 */
diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
index 41f67bd895..861004801e 100644
--- a/src/conf/checkpoint_conf.c
+++ b/src/conf/checkpoint_conf.c
@@ -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,
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index dd3db00bc8..7be108fa63 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -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 (virDomainNumaDefCPUFormatXML(&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
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e5070ed871..706d050f4d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29543,7 +29543,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)
@@ -29588,13 +29588,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;
@@ -29617,13 +29617,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",
@@ -29641,17 +29641,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) {
@@ -29731,7 +29731,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);
}
@@ -29763,7 +29763,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);
}
@@ -29794,10 +29794,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));
@@ -29828,7 +29828,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");
@@ -29837,20 +29837,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");
@@ -29877,35 +29877,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;
@@ -29923,36 +29923,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++) {
@@ -29962,13 +29962,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)
@@ -29976,7 +29976,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)
@@ -29987,7 +29987,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)
@@ -29995,26 +29995,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");
@@ -30029,18 +30029,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
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 99f11fdf05..0fd68a7d66 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -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;
}
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 3827c65462..02722abc32 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -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;
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index 3960cf04ad..2e35348ce1 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -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;
}
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index b7ed3b42df..07336e914f 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -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;
}
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 7bc743887c..65d9b33049 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -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;
}
diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 5d90dec2bc..8b12ce0482 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -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;
}
diff --git a/src/conf/virsavecookie.c b/src/conf/virsavecookie.c
index 429daf69be..d8c51ce0ef 100644
--- a/src/conf/virsavecookie.c
+++ b/src/conf/virsavecookie.c
@@ -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;
}
--
2.25.4