Re: [PATCH v2 04/32] conf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStoragePoolSource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 08, 2019 at 01:36:58PM -0500, John Ferlan wrote:
Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
src/conf/storage_conf.c                    |  4 ++--
src/conf/storage_conf.h                    |  2 ++
src/storage/storage_backend_fs.c           |  3 +--
src/storage/storage_backend_gluster.c      |  3 +--
src/storage/storage_backend_iscsi.c        |  3 +--
src/storage/storage_backend_iscsi_direct.c |  3 +--
src/test/test_driver.c                     | 14 +++++++-------
7 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index b06567855e..de221b4190 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4404,30 +4404,32 @@ testConnectFindStoragePoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
    if (!pool_type) {
        virReportError(VIR_ERR_INTERNAL_ERROR,
                       _("unknown storage pool type %s"), type);
-        goto cleanup;
+        return NULL;
    }

    if (srcSpec) {
        source = virStoragePoolDefParseSourceString(srcSpec, pool_type);
        if (!source)
-            goto cleanup;
+            return NULL;
    }

    switch (pool_type) {

    case VIR_STORAGE_POOL_LOGICAL:
        ignore_value(VIR_STRDUP(ret, defaultPoolSourcesLogicalXML));
+        return ret;
        break;

unreachable break


    case VIR_STORAGE_POOL_NETFS:
        if (!source || !source->hosts[0].name) {
            virReportError(VIR_ERR_INVALID_ARG,
                           "%s", _("hostname must be specified for netfs sources"));
-            goto cleanup;
+            return NULL;
        }

        ignore_value(virAsprintf(&ret, defaultPoolSourcesNetFSXML,
                                 source->hosts[0].name));
+        return ret;
        break;

same here


    default:

With the breaks removed:
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux