From nobody Mon Feb 9 23:16:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594007119; cv=none; d=zohomail.com; s=zohoarc; b=SubXZhqyL0RcvYKBS7QfbKzbtY8w8awSGMfvwdFunGwKzdVcecvWbZ6fGpW+/GKd9BUxrWBKp3oVgLNrH0l8piznSiw7O/a+rFpQZzfUMZBMdvqatXbgJiViXVAigk8fN/n6B0QIGJYLet0ZDYhMFCzWEun6B/qCIuLAVuscRO8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594007119; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bSFetdmW78tPL3tWwdAUTqVEy3cQWqHMgdSF+OwdzfI=; b=YCiZk7pEMmfjl8Fj4MTlGjDAyjozIoxQBE+8+prqTuZd5vbX6GTR+kW2eN4AfWINC/dNPlQZRBgpU4Ytxy6jEtOXGSUw7/hWv+6hM/LsNBkt99la01DCrjzykPMB+igZEjuSGss4f0jk9a+kDhHqGp58r1yiDeU6ITJt6VyjX6I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594007119259372.5912098710819; Sun, 5 Jul 2020 20:45:19 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-507-49UwntP9PXiy_pTs0WO8qQ-1; Sun, 05 Jul 2020 23:42:35 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CC970805F0C; Mon, 6 Jul 2020 03:42:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADE6E5D9E4; Mon, 6 Jul 2020 03:42:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 80DA11805318; Mon, 6 Jul 2020 03:42:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0663g7xW004702 for ; Sun, 5 Jul 2020 23:42:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 89FBA275E36; Mon, 6 Jul 2020 03:42:07 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-194.phx2.redhat.com [10.3.112.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C017275E3B for ; Mon, 6 Jul 2020 03:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594007118; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=bSFetdmW78tPL3tWwdAUTqVEy3cQWqHMgdSF+OwdzfI=; b=FIlRQmiKzZZPVzpaNieid6ruN/fUQx3Az/rXToz2JRxHPEpNFJkB5RlF1ASDjy6mb6IT7t josOR3juvCFxQZPoBI/5GRJ2feVjbNWyPTw2yvus4hlpZ1MYHg7Vz5UWPYmRSdrnf6pUKd kgD2pxinrxF8A7B/uMnrjKqRPnjiFvM= X-MC-Unique: 49UwntP9PXiy_pTs0WO8qQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 21/32] conf: eliminate unnecessary labels Date: Sun, 5 Jul 2020 23:41:16 -0400 Message-Id: <20200706034127.1117504-22-laine@redhat.com> In-Reply-To: <20200706034127.1117504-1-laine@redhat.com> References: <20200706034127.1117504-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- 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); =20 if (virCapabilitiesFormatHostXML(&caps->host, &buf) < 0) - goto error; + return NULL; =20 virCapabilitiesFormatGuestXML(caps->guests, caps->nguests, &buf); =20 @@ -1350,9 +1350,6 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(&buf, "\n"); =20 return virBufferContentAndReset(&buf); - - error: - return NULL; } =20 /* 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 =3D 0; i < def->ndisks; i++) { if (virDomainCheckpointDiskDefFormat(buf, &def->disks[i], flags) < 0) - goto error; + return -1; } virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\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; =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); =20 return 0; - - error: - return -1; } =20 + 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 =3D VIR_BUFFER_INITIALIZER; =20 if (virCPUDefFormatBufFull(&buf, def, numa) < 0) - goto cleanup; + return NULL; =20 return virBufferContentAndReset(&buf); - - cleanup: - return NULL; } =20 =20 @@ -685,7 +682,6 @@ virCPUDefFormatBufFull(virBufferPtr buf, virCPUDefPtr def, virDomainNumaPtr numa) { - int ret =3D -1; g_auto(virBuffer) attributeBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) childrenBuf =3D VIR_BUFFER_INIT_CHILD(buf); =20 @@ -701,7 +697,7 @@ virCPUDefFormatBufFull(virBufferPtr buf, if (!(tmp =3D virCPUModeTypeToString(def->mode))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected CPU mode %d"), def->mode); - goto cleanup; + return -1; } virBufferAsprintf(&attributeBuf, " mode=3D'%s'", tmp); =20 @@ -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=3D'%s'", tmp); } @@ -731,10 +727,10 @@ virCPUDefFormatBufFull(virBufferPtr buf, virBufferAsprintf(&childrenBuf, "%s\n", virArchToString(def->arch)); if (virCPUDefFormatBuf(&childrenBuf, def) < 0) - goto cleanup; + return -1; =20 if (virDomainNumaDefCPUFormatXML(&childrenBuf, numa) < 0) - goto cleanup; + return -1; =20 /* Put it all together */ if (virBufferUse(&attributeBuf) || virBufferUse(&childrenBuf)) { @@ -752,9 +748,7 @@ virCPUDefFormatBufFull(virBufferPtr buf, } } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 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(virDomainDefP= tr def, if (!(type =3D virDomainVirtTypeToString(def->virtType))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected domain type %d"), def->virtType); - goto error; + return -1; } =20 if (def->id =3D=3D -1) @@ -29588,13 +29588,13 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr def, xmlIndentTreeOutput =3D 1; if (!(xmlbuf =3D xmlBufferCreate())) { virReportOOMError(); - goto error; + return -1; } =20 if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata, virBufferGetIndent(buf) / 2, 1) < 0) { xmlIndentTreeOutput =3D oldIndentTreeOutput; - goto error; + return -1; } virBufferAsprintf(buf, "%s\n", (char *) xmlBufferContent(xmlbuf)); xmlIndentTreeOutput =3D oldIndentTreeOutput; @@ -29617,13 +29617,13 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr def, def->mem.cur_balloon); =20 if (virDomainDefFormatBlkiotune(buf, def) < 0) - goto error; + return -1; =20 virDomainMemtuneFormat(buf, &def->mem); virDomainMemorybackingFormat(buf, &def->mem); =20 if (virDomainCpuDefFormat(buf, def) < 0) - goto error; + return -1; =20 if (def->niothreadids > 0) { virBufferAsprintf(buf, "%zu\n", @@ -29641,17 +29641,17 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr def, } =20 if (virDomainCputuneDefFormat(buf, def, flags) < 0) - goto error; + return -1; =20 if (virDomainNumatuneFormatXML(buf, def->numa) < 0) - goto error; + return -1; =20 if (def->resource) virDomainResourceDefFormat(buf, def->resource); =20 for (i =3D 0; i < def->nsysinfo; i++) { if (virSysinfoFormat(buf, def->sysinfo[i]) < 0) - goto error; + return -1; } =20 if (def->os.bootloader) { @@ -29731,7 +29731,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected boot device type %d"), def->os.bootDevs[n]); - goto error; + return -1; } virBufferAsprintf(buf, "\n", boottype); } @@ -29763,7 +29763,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, if (mode =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected smbios mode %d"), def->os.smbios_= mode); - goto error; + return -1; } virBufferAsprintf(buf, "\n", mode); } @@ -29794,10 +29794,10 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr def, } =20 if (virDomainDefFormatFeatures(buf, def) < 0) - goto error; + return -1; =20 if (virCPUDefFormatBufFull(buf, def->cpu, def->numa) < 0) - goto error; + return -1; =20 virBufferAsprintf(buf, "clock.offset)); @@ -29828,7 +29828,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, virBufferAdjustIndent(buf, 2); for (n =3D 0; n < def->clock.ntimers; n++) { if (virDomainTimerDefFormat(buf, def->clock.timers[n]) < 0) - goto error; + return -1; } virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -29837,20 +29837,20 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr 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 !=3D VIR_DOMAIN_LOCK_FAILURE_DEFAULT && virDomainEventActionDefFormat(buf, def->onLockFailure, "on_lockfailure", virDomainLockFailureTypeToString) < = 0) - goto error; + return -1; =20 if (def->pm.s3 || def->pm.s4) { virBufferAddLit(buf, "\n"); @@ -29877,35 +29877,35 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr def, =20 for (n =3D 0; n < def->ndisks; n++) if (virDomainDiskDefFormat(buf, def->disks[n], flags, xmlopt) < 0) - goto error; + return -1; =20 for (n =3D 0; n < def->ncontrollers; n++) if (virDomainControllerDefFormat(buf, def->controllers[n], flags) = < 0) - goto error; + return -1; =20 for (n =3D 0; n < def->nleases; n++) if (virDomainLeaseDefFormat(buf, def->leases[n]) < 0) - goto error; + return -1; =20 for (n =3D 0; n < def->nfss; n++) if (virDomainFSDefFormat(buf, def->fss[n], flags) < 0) - goto error; + return -1; =20 for (n =3D 0; n < def->nnets; n++) if (virDomainNetDefFormat(buf, def->nets[n], xmlopt, flags) < 0) - goto error; + return -1; =20 for (n =3D 0; n < def->nsmartcards; n++) if (virDomainSmartcardDefFormat(buf, def->smartcards[n], flags) < = 0) - goto error; + return -1; =20 for (n =3D 0; n < def->nserials; n++) if (virDomainChrDefFormat(buf, def->serials[n], flags) < 0) - goto error; + return -1; =20 for (n =3D 0; n < def->nparallels; n++) if (virDomainChrDefFormat(buf, def->parallels[n], flags) < 0) - goto error; + return -1; =20 for (n =3D 0; n < def->nconsoles; n++) { virDomainChrDef console; @@ -29923,36 +29923,36 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr def, memcpy(&console, def->consoles[n], sizeof(console)); } if (virDomainChrDefFormat(buf, &console, flags) < 0) - goto error; + return -1; } =20 for (n =3D 0; n < def->nchannels; n++) if (virDomainChrDefFormat(buf, def->channels[n], flags) < 0) - goto error; + return -1; =20 for (n =3D 0; n < def->ninputs; n++) { if (virDomainInputDefFormat(buf, def->inputs[n], flags) < 0) - goto error; + return -1; } =20 for (n =3D 0; n < def->ntpms; n++) { if (virDomainTPMDefFormat(buf, def->tpms[n], flags) < 0) - goto error; + return -1; } =20 for (n =3D 0; n < def->ngraphics; n++) { if (virDomainGraphicsDefFormat(buf, def->graphics[n], flags) < 0) - goto error; + return -1; } =20 for (n =3D 0; n < def->nsounds; n++) { if (virDomainSoundDefFormat(buf, def->sounds[n], flags) < 0) - goto error; + return -1; } =20 for (n =3D 0; n < def->nvideos; n++) { if (virDomainVideoDefFormat(buf, def->videos[n], flags) < 0) - goto error; + return -1; } =20 for (n =3D 0; n < def->nhostdevs; n++) { @@ -29962,13 +29962,13 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr def, */ if (!def->hostdevs[n]->parentnet && virDomainHostdevDefFormat(buf, def->hostdevs[n], flags) < 0) { - goto error; + return -1; } } =20 for (n =3D 0; n < def->nredirdevs; n++) { if (virDomainRedirdevDefFormat(buf, def->redirdevs[n], flags) < 0) - goto error; + return -1; } =20 if (def->redirfilter) @@ -29976,7 +29976,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, =20 for (n =3D 0; n < def->nhubs; n++) { if (virDomainHubDefFormat(buf, def->hubs[n], flags) < 0) - goto error; + return -1; } =20 if (def->watchdog) @@ -29987,7 +29987,7 @@ virDomainDefFormatInternalSetRootName(virDomainDefP= tr def, =20 for (n =3D 0; n < def->nrngs; n++) { if (virDomainRNGDefFormat(buf, def->rngs[n], flags)) - goto error; + return -1; } =20 if (def->nvram) @@ -29995,26 +29995,26 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr def, =20 for (n =3D 0; n < def->npanics; n++) { if (virDomainPanicDefFormat(buf, def->panics[n]) < 0) - goto error; + return -1; } =20 for (n =3D 0; n < def->nshmems; n++) { if (virDomainShmemDefFormat(buf, def->shmems[n], flags) < 0) - goto error; + return -1; } =20 for (n =3D 0; n < def->nmems; n++) { if (virDomainMemoryDefFormat(buf, def->mems[n], def, flags) < 0) - goto error; + return -1; } =20 if (def->iommu && virDomainIOMMUDefFormat(buf, def->iommu) < 0) - goto error; + return -1; =20 if (def->vsock && virDomainVsockDefFormat(buf, def->vsock) < 0) - goto error; + return -1; =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); @@ -30029,18 +30029,16 @@ virDomainDefFormatInternalSetRootName(virDomainDe= fPtr def, =20 if (def->namespaceData && def->ns.format) { if ((def->ns.format)(buf, def->namespaceData) < 0) - goto error; + return -1; } =20 virBufferAdjustIndent(buf, -2); virBufferAsprintf(buf, "\n", rootname); =20 return 0; - - error: - return -1; } =20 + /* 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 =3D VIR_BUFFER_INITIALIZER; =20 if (virNetworkDefFormatBuf(&buf, def, xmlopt, flags) < 0) - goto error; + return NULL; =20 return virBufferContentAndReset(&buf); - - error: - return NULL; } =20 =20 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) =20 for (i =3D 0; i < def->nentries; i++) { if (virNWFilterEntryFormat(&buf, def->filterEntries[i]) < 0) - goto err_exit; + return NULL; } =20 virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); =20 return virBufferContentAndReset(&buf); - - err_exit: - return NULL; } =20 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 !=3D VIR_SECRET_USAGE_TYPE_NONE && virSecretDefFormatUsage(&buf, def) < 0) - goto error; + return NULL; virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); =20 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 =3D 0; i < def->ndisks; i++) { if (virDomainSnapshotDiskDefFormat(buf, &def->disks[i], xmlopt= ) < 0) - goto error; + return -1; } virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\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, "\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; } =20 if (virSaveCookieFormatBuf(buf, def->cookie, virDomainXMLOptionGetSaveCookie(xmlopt)) < = 0) - goto error; + return -1; =20 if (flags & VIR_DOMAIN_SNAPSHOT_FORMAT_INTERNAL) virBufferAsprintf(buf, "%d\n", @@ -914,9 +914,6 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf, virBufferAddLit(buf, "\n"); =20 return 0; - - error: - return -1; } =20 =20 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 =3D VIR_BUFFER_INITIALIZER; =20 if (virStoragePoolDefFormatBuf(&buf, def) < 0) - goto error; + return NULL; =20 return virBufferContentAndReset(&buf); - - error: - return NULL; } =20 =20 @@ -1648,21 +1645,18 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, =20 if (virStorageVolTargetDefFormat(options, &buf, &def->target, "target") < 0) - goto cleanup; + return NULL; =20 if (virStorageSourceHasBacking(&def->target) && virStorageVolTargetDefFormat(options, &buf, def->target.backingStore, "backingStore") < 0) - goto cleanup; + return NULL; =20 virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); =20 return virBufferContentAndReset(&buf); - - cleanup: - return NULL; } =20 =20 @@ -1753,7 +1747,7 @@ virStoragePoolSourceListFormat(virStoragePoolSourceLi= stPtr def) if (!type) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("unexpected pool type")); - goto cleanup; + return NULL; } =20 virBufferAddLit(&buf, "\n"); @@ -1766,7 +1760,4 @@ virStoragePoolSourceListFormat(virStoragePoolSourceLi= stPtr def) virBufferAddLit(&buf, "\n"); =20 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; =20 if (!classIdStr) - goto error; + return NULL; =20 virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); @@ -835,15 +835,12 @@ virNetworkObjFormat(virNetworkObjPtr obj, } =20 if (virNetworkDefFormatBuf(&buf, obj->def, xmlopt, flags) < 0) - goto error; + return NULL; =20 virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, ""); =20 return virBufferContentAndReset(&buf); - - error: - return NULL; } =20 =20 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 =3D VIR_BUFFER_INITIALIZER; =20 if (virSaveCookieFormatBuf(&buf, obj, saveCookie) < 0) - goto error; + return NULL; =20 return virBufferContentAndReset(&buf); - - error: - return NULL; } --=20 2.25.4