From nobody Sat May 4 12:51:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551957188938327.1043155752493; Thu, 7 Mar 2019 03:13:08 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CE4B3089E61; Thu, 7 Mar 2019 11:13:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 849D85C545; Thu, 7 Mar 2019 11:13:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6AB4C181A12C; Thu, 7 Mar 2019 11:13:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x27BD4DB029661 for ; Thu, 7 Mar 2019 06:13:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id F2C3517D0F; Thu, 7 Mar 2019 11:13:03 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 775835D9C6 for ; Thu, 7 Mar 2019 11:13:01 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 7 Mar 2019 12:13:00 +0100 Message-Id: <8c0fe9c64980235c6ce4eff32f8c54f3f851fb44.1551957174.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] tests: use VIR_AUTOUNREF in storagepoolcapstest X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 07 Mar 2019 11:13:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- tests/storagepoolcapstest.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/tests/storagepoolcapstest.c b/tests/storagepoolcapstest.c index f8b560c2f0..518a5fdfe7 100644 --- a/tests/storagepoolcapstest.c +++ b/tests/storagepoolcapstest.c @@ -54,30 +54,26 @@ test_virStoragePoolCapsFormat(const void *opaque) struct test_virStoragePoolCapsFormatData *data =3D (struct test_virStoragePoolCapsFormatData *) opaque; virCapsPtr driverCaps =3D data->driverCaps; - virStoragePoolCapsPtr poolCaps =3D NULL; - int ret =3D -1; + VIR_AUTOUNREF(virStoragePoolCapsPtr) poolCaps =3D NULL; VIR_AUTOFREE(char *) path =3D NULL; VIR_AUTOFREE(char *) poolCapsXML =3D NULL; =20 =20 if (!(poolCaps =3D virStoragePoolCapsNew(driverCaps))) - goto cleanup; + return -1; =20 if (virAsprintf(&path, "%s/storagepoolcapsschemadata/poolcaps-%s.xml", - abs_srcdir, data->filename) < 0) - goto cleanup; + abs_srcdir, data->filename) < 0) { + return -1; + } =20 if (!(poolCapsXML =3D virStoragePoolCapsFormat(poolCaps))) - goto cleanup; + return -1; =20 if (virTestCompareToFile(poolCapsXML, path) < 0) - goto cleanup; + return -1; =20 - ret =3D 0; - - cleanup: - virObjectUnref(poolCaps); - return ret; + return 0; } =20 =20 @@ -85,8 +81,8 @@ static int mymain(void) { int ret =3D 0; - virCapsPtr fullCaps =3D NULL; - virCapsPtr fsCaps =3D NULL; + VIR_AUTOUNREF(virCapsPtr) fullCaps =3D NULL; + VIR_AUTOUNREF(virCapsPtr) fsCaps =3D NULL; =20 #define DO_TEST(Filename, DriverCaps) \ do { \ @@ -98,8 +94,7 @@ mymain(void) =20 if (!(fullCaps =3D virCapabilitiesNew(VIR_ARCH_NONE, false, false)) || !(fsCaps =3D virCapabilitiesNew(VIR_ARCH_NONE, false, false))) { - ret =3D -1; - goto cleanup; + return -1; } =20 test_virCapabilitiesAddFullStoragePool(fullCaps); @@ -108,10 +103,6 @@ mymain(void) DO_TEST("full", fullCaps); DO_TEST("fs", fsCaps); =20 - cleanup: - virObjectUnref(fullCaps); - virObjectUnref(fsCaps); - return ret; } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list