[libvirt] [PATCH v2 04/32] conf: Introduce VIR_DEFINE_AUTOPTR_FUNC for virStoragePoolSource
Ján Tomko
jtomko at redhat.com
Mon Feb 11 11:28:02 UTC 2019
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 at redhat.com>
>Reviewed-by: Erik Skultety <eskultet at redhat.com>
>---
> 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 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/20190211/0d4f31a5/attachment-0001.sig>
More information about the libvir-list
mailing list