[libvirt] [PATCH v3 08/10] conf: Clean up some unnecessary goto paths
Ján Tomko
jtomko at redhat.com
Mon Mar 4 14:28:06 UTC 2019
On Fri, Mar 01, 2019 at 11:26:50AM -0500, John Ferlan wrote:
>Now that we're using VIR_AUTOFREE there's quite a bit of clean up
>possible for now unnecessary goto paths.
>
>Signed-off-by: John Ferlan <jferlan at redhat.com>
>Reviewed-by: Erik Skultety <eskultet at redhat.com>
>---
> src/conf/domain_conf.c | 801 ++++++++++++++++-------------------------
> 1 file changed, 310 insertions(+), 491 deletions(-)
>
>@@ -7692,7 +7659,6 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
> virDomainHostdevSubsysSCSIPtr scsisrc,
> xmlXPathContextPtr ctxt)
> {
>- int ret = -1;
> VIR_AUTOFREE(char *) protocol = NULL;
>
> if ((protocol = virXMLPropString(sourcenode, "protocol"))) {
>@@ -7702,17 +7668,14 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
> virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> _("Unknown SCSI subsystem protocol '%s'"),
> protocol);
>- goto cleanup;
>+ return -1;
> }
> }
>
> if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
>- ret = virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsisrc, ctxt);
>- else
>- ret = virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);
>+ return virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsisrc, ctxt);
>
>- cleanup:
>- return ret;
>+ return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);
This looks odd. But having the else branch would look even more so.
> }
>
> static int
Reviewed-by: Ján Tomko <jtomko at redhat.com>
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190304/b1d3ebd3/attachment-0001.sig>
More information about the libvir-list
mailing list