[libvirt] [PATCH 07/34] conf: Simplify control flow in virDomainDiskSourceFormat

Peter Krempa posted 34 patches 6 years, 10 months ago
There is a newer version of this series
[libvirt] [PATCH 07/34] conf: Simplify control flow in virDomainDiskSourceFormat
Posted by Peter Krempa 6 years, 10 months ago
Now that the cleanup section is handled automatically it can be removed.

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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 79e15c9886..b78481c280 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23907,21 +23907,14 @@ 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,
                                      seclabels, attrIndex, policy, xmlopt) < 0)
-        goto cleanup;
-
-    if (virXMLFormatElement(buf, "source", &attrBuf, &childBuf) < 0)
-        goto cleanup;
-
-    ret = 0;
+        return -1;

- cleanup:
-    return ret;
+    return virXMLFormatElement(buf, "source", &attrBuf, &childBuf);
 }


-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 07/34] conf: Simplify control flow in virDomainDiskSourceFormat
Posted by Ján Tomko 6 years, 10 months ago
On Mon, Mar 18, 2019 at 04:54:56PM +0100, Peter Krempa wrote:
>Now that the cleanup section is handled automatically it can be removed.
>

d/section /

>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/conf/domain_conf.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 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