[libvirt] [PATCH v2 10/29] conf: Simplify control flow in virDomainDiskSourceFormat

Peter Krempa posted 29 patches 6 years, 10 months ago
[libvirt] [PATCH v2 10/29] conf: Simplify control flow in virDomainDiskSourceFormat
Posted by Peter Krempa 6 years, 10 months ago
Now that the cleanup is handled automatically it can be removed.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/conf/domain_conf.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ec81d380d5..fa4454a6ca 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23797,12 +23797,11 @@ virDomainDiskSourceFormat(virBufferPtr buf,
 {
     VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
     VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
-    int ret = -1;

     virBufferSetChildIndent(&childBuf, buf);

     if (virDomainStorageSourceFormat(&attrBuf, &childBuf, src, flags) < 0)
-        goto cleanup;
+        return -1;

     if (policy && src->type != VIR_STORAGE_TYPE_NETWORK)
         virBufferEscapeString(&attrBuf, " startupPolicy='%s'",
@@ -23812,15 +23811,12 @@ virDomainDiskSourceFormat(virBufferPtr buf,
         virBufferAsprintf(&attrBuf, " index='%u'", src->id);

     if (virDomainDiskSourceFormatPrivateData(&childBuf, src, flags, xmlopt) < 0)
-        goto cleanup;
+        return -1;

     if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0)
-        goto cleanup;
-
-    ret = 0;
+        return -1;

- cleanup:
-    return ret;
+    return 0;
 }


-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 10/29] conf: Simplify control flow in virDomainDiskSourceFormat
Posted by Ján Tomko 6 years, 10 months ago
On Fri, Mar 22, 2019 at 07:00:46PM +0100, Peter Krempa wrote:
>Now that the cleanup is handled automatically it can be removed.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/conf/domain_conf.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list