From nobody Sat Apr 20 00:36:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1595979890; cv=none; d=zohomail.com; s=zohoarc; b=NfalKqBSMB7Q2z54jJVqlemQk3L/QXk4gBk3yGqd6NIC5m0jLxHLj+VOwDIS5i7XzI2sc1pLB3kqxtXfbcVXdv8g83mZeYkeg65e3x3+614VVo8te/uquM5sNi+G7tjEkb3CmAZVsWhppU3dfMqFH/uJU0K1ea/BfDkdQbYOH3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595979890; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eNszvJGrugugaU5Vnn4lp97JLjSjVRe1nxOOnujz+Tk=; b=SPFkvBRoH2sT/WD3lGiggIvhqNSre5bTtWR1PEtyx0Do0ZI4R8U2T5Q3dd7yh2WUnJnH3qRtpRbzUOt3BBy/BzLP9sSUeytOWkPwwjumWi8l1v6LZwWVqYC6+I8vZpgY+fhilqPnJKdHFodhe0HW1fXLqzMywlGdYf0R9uINaEE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 15959798907781014.6455444310549; Tue, 28 Jul 2020 16:44:50 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-295-klH_Ab1RNamWef8rjkyNDQ-1; Tue, 28 Jul 2020 19:44:47 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0603C19067E1; Tue, 28 Jul 2020 23:44:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC33871909; Tue, 28 Jul 2020 23:44:40 +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 AC5ADA35A3; Tue, 28 Jul 2020 23:44:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06SNibfJ004471 for ; Tue, 28 Jul 2020 19:44:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1F9982C724; Tue, 28 Jul 2020 23:44:37 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65CFD59 for ; Tue, 28 Jul 2020 23:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595979889; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eNszvJGrugugaU5Vnn4lp97JLjSjVRe1nxOOnujz+Tk=; b=OiN0dKjYm7nS3xnqUsa3C0Mspv5kCAq+91A9DBg0tGuCJI2dJ9VyxSOxNdcxvkbppWI9kO TOOCZrcPdU4LfpkOnKxrBE0Qv8E21KmM6gHQuARZr9MW3W0xaGPhru8RdbAqMiyfp9azbH ccqKLioZn7LGWLqQ7nnah2eYSUl2Z4k= X-MC-Unique: klH_Ab1RNamWef8rjkyNDQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] tests: bhyve: split variable declarations Date: Wed, 29 Jul 2020 01:44:24 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) One variable per line. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Laine Stump Reviewed-by: Roman Bogorodskiy --- tests/bhyvexml2argvtest.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 9e7eb218b8..f7ae1db26d 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -26,9 +26,12 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *dmcmdline, unsigned int flags) { - char *actualargv =3D NULL, *actualld =3D NULL, *actualdm =3D NULL; + char *actualargv =3D NULL; + char *actualld =3D NULL; + char *actualdm =3D NULL; virDomainDefPtr vmdef =3D NULL; - virCommandPtr cmd =3D NULL, ldcmd =3D NULL; + virCommandPtr cmd =3D NULL; + virCommandPtr ldcmd =3D NULL; virConnectPtr conn; int ret =3D -1; =20 @@ -117,7 +120,9 @@ testCompareXMLToArgvHelper(const void *data) int ret =3D -1; const struct testInfo *info =3D data; char *xml =3D NULL; - char *args =3D NULL, *ldargs =3D NULL, *dmargs =3D NULL; + char *args =3D NULL; + char *ldargs =3D NULL; + char *dmargs =3D NULL; =20 xml =3D g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.xml", abs_srcdir, info->name); --=20 2.26.2 From nobody Sat Apr 20 00:36:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1595979892; cv=none; d=zohomail.com; s=zohoarc; b=DT8j23MlxRzRV3qgVPCmp1P/RSs62YRbC/evbCa5e0j7b91jt7fAn7H1fpvSf0Sz/FeIgRSaMHttT6bb9l0RoNuGDvCyVH3VMkkELkTScDZoJckSs9CERAG3sHWh9NHnPesBx0JpMRm1xC9LXX0xG7ejJFpBFK0HFDGef+hBnFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595979892; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=if6NvhguyOUulTR3RzyjGWMYrblKGHGWvYkg71afunk=; b=MZwaNo+5d0tYA5G22LmcZge60mgRDzbjFKT3E3Vq/KyNb7zkm50JR2IUQamLhOSSj2i9jI7kQhDMbnksSwBqks96johSPD8G6dLjn4mHVsnk/5m5vb0Dqp9KuFIumi3YN8vkLK0fw5dBGX3R5Elz2bf9Hzjlt/cV+ul9HgtgGuk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1595979892893402.77364265178255; Tue, 28 Jul 2020 16:44:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-165-hSAf-BKuMcesbQwUFyX80A-1; Tue, 28 Jul 2020 19:44:49 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B21B0100A8CF; Tue, 28 Jul 2020 23:44:43 +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 3056760E1C; Tue, 28 Jul 2020 23:44:43 +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 F24591809561; Tue, 28 Jul 2020 23:44:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06SNicea004480 for ; Tue, 28 Jul 2020 19:44:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C2EF2C724; Tue, 28 Jul 2020 23:44:38 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 840C859 for ; Tue, 28 Jul 2020 23:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595979891; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=if6NvhguyOUulTR3RzyjGWMYrblKGHGWvYkg71afunk=; b=SPDyxZJ4/CGuxypAo76BiJgUPsNTisLgNY/r1yTWRYqG5y/CRASPqsuBB84TjwSJCEDHKX ePQAWeIymBsVYbYUPZ8DW11Xrjs9ckbJMkfVrrxlfa4YvyrJ/UYcIlW3BB6Wh0JBOGai6X 9rx87Eka2ZOD4JpepLCptz/4NlBzjbg= X-MC-Unique: hSAf-BKuMcesbQwUFyX80A-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] tests: bhyve: use g_autofree where possible Date: Wed, 29 Jul 2020 01:44:25 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko Reviewed-by: Laine Stump Reviewed-by: Roman Bogorodskiy --- tests/bhyveargv2xmltest.c | 16 +++++----------- tests/bhyvexml2argvtest.c | 21 +++++++-------------- tests/bhyvexml2xmltest.c | 6 ++---- 3 files changed, 14 insertions(+), 29 deletions(-) diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index 735cc4b338..e58a36d17c 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -28,9 +28,9 @@ testCompareXMLToArgvFiles(const char *xmlfile, unsigned int flags) =20 { - char *actualxml =3D NULL; - char *cmd =3D NULL; - char *log =3D NULL; + g_autofree char *actualxml =3D NULL; + g_autofree char *cmd =3D NULL; + g_autofree char *log =3D NULL; int ret =3D -1; virDomainDefPtr vmdef =3D NULL; =20 @@ -86,9 +86,6 @@ testCompareXMLToArgvFiles(const char *xmlfile, ret =3D 0; =20 fail: - VIR_FREE(actualxml); - VIR_FREE(cmd); - VIR_FREE(log); virDomainDefFree(vmdef); return ret; } @@ -103,8 +100,8 @@ testCompareXMLToArgvHelper(const void *data) { int result =3D -1; const struct testInfo *info =3D data; - char *xml =3D NULL; - char *args =3D NULL; + g_autofree char *xml =3D NULL; + g_autofree char *args =3D NULL; =20 xml =3D g_strdup_printf("%s/bhyveargv2xmldata/bhyveargv2xml-%s.xml", abs_srcdir, info->name); @@ -112,9 +109,6 @@ testCompareXMLToArgvHelper(const void *data) abs_srcdir, info->name); =20 result =3D testCompareXMLToArgvFiles(xml, args, info->flags); - - VIR_FREE(xml); - VIR_FREE(args); return result; } =20 diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index f7ae1db26d..ce2af08d4c 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -26,9 +26,9 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *dmcmdline, unsigned int flags) { - char *actualargv =3D NULL; - char *actualld =3D NULL; - char *actualdm =3D NULL; + g_autofree char *actualargv =3D NULL; + g_autofree char *actualld =3D NULL; + g_autofree char *actualdm =3D NULL; virDomainDefPtr vmdef =3D NULL; virCommandPtr cmd =3D NULL; virCommandPtr ldcmd =3D NULL; @@ -99,9 +99,6 @@ static int testCompareXMLToArgvFiles(const char *xml, vmdef->graphics[0]->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_VNC) virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port); =20 - VIR_FREE(actualargv); - VIR_FREE(actualld); - VIR_FREE(actualdm); virCommandFree(cmd); virCommandFree(ldcmd); virDomainDefFree(vmdef); @@ -119,10 +116,10 @@ testCompareXMLToArgvHelper(const void *data) { int ret =3D -1; const struct testInfo *info =3D data; - char *xml =3D NULL; - char *args =3D NULL; - char *ldargs =3D NULL; - char *dmargs =3D NULL; + g_autofree char *xml =3D NULL; + g_autofree char *args =3D NULL; + g_autofree char *ldargs =3D NULL; + g_autofree char *dmargs =3D NULL; =20 xml =3D g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.xml", abs_srcdir, info->name); @@ -135,10 +132,6 @@ testCompareXMLToArgvHelper(const void *data) =20 ret =3D testCompareXMLToArgvFiles(xml, args, ldargs, dmargs, info->fla= gs); =20 - VIR_FREE(xml); - VIR_FREE(args); - VIR_FREE(ldargs); - VIR_FREE(dmargs); return ret; } =20 diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index a0c20a14c1..2ac102b8e3 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -26,8 +26,8 @@ static int testCompareXMLToXMLHelper(const void *data) { const struct testInfo *info =3D data; - char *xml_in =3D NULL; - char *xml_out =3D NULL; + g_autofree char *xml_in =3D NULL; + g_autofree char *xml_out =3D NULL; bool is_different =3D info->flags & FLAG_IS_DIFFERENT; int ret =3D -1; =20 @@ -48,8 +48,6 @@ testCompareXMLToXMLHelper(const void *data) virResetLastError(); } =20 - VIR_FREE(xml_in); - VIR_FREE(xml_out); return ret; } =20 --=20 2.26.2 From nobody Sat Apr 20 00:36:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1595979891; cv=none; d=zohomail.com; s=zohoarc; b=QIAdoUV416vVS6nRIBcNXtUx6/zjwwTnzW54DikKorwOqea2ItEUW6gYAj/SDmTvN8gg6mbcQpjUYN+sXTj+6MYY4uqvYS9dWtHJhgcnEGLYbhjdn5J6YuMXpN5klssQUd5B4AOLsE6EDTPfSjwxOIDLk60n12y29iOG9YfiOqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595979891; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pUYvNyroLKA+NLt752bPoyo/DH95deEewvDjwxI8hs4=; b=GSdTjhoJ+KAQIlrDcifzhSsNnklW3HDlEE+90ukDESXraFWVRKRdPuF7Y4PX2n9ZBZ6kDQHoDC/OrT7xuGyhhJJH1mAem8e7NDkP9w4Dk5IkOdMdehH3CyKW7Yhp3woRyxu9WTnwY33undb+/NQZTIvU84wRDYxzL6CHPlk32J4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 159597989122159.771559627745205; Tue, 28 Jul 2020 16:44:51 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-438-uQ23XJSTOt6E63IDWVxKiQ-1; Tue, 28 Jul 2020 19:44:47 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 588AD8015CE; Tue, 28 Jul 2020 23:44:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 39FF169327; Tue, 28 Jul 2020 23:44:41 +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 09FEEA35B4; Tue, 28 Jul 2020 23:44:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06SNidt0004488 for ; Tue, 28 Jul 2020 19:44:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 225682C724; Tue, 28 Jul 2020 23:44:39 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FA7759 for ; Tue, 28 Jul 2020 23:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595979890; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pUYvNyroLKA+NLt752bPoyo/DH95deEewvDjwxI8hs4=; b=NtpFP3oR4p30m6mKaKSEOVSi93y1aHVA8lJL3d2KpGNqJw+4saIBgszNlbdV8m6K4hVHSw FZPtPmhiFU+EVT71DwVRElzgbloycNcgfG/nt+U6h3mn6w9a3C4yw5vSya1hpR3DFs6ulU zNghY8siHuDbi9YD6dhOWbQAht5uTq4= X-MC-Unique: uQ23XJSTOt6E63IDWVxKiQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] tests: bhyve: use g_autoptr where possible Date: Wed, 29 Jul 2020 01:44:26 +0200 Message-Id: <083d9227d5e68fc37650bc2ffab2c4142e126a68.1595979850.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko Reviewed-by: Laine Stump Reviewed-by: Roman Bogorodskiy --- tests/bhyveargv2xmltest.c | 3 +-- tests/bhyvexml2argvtest.c | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index e58a36d17c..e7ec3ae020 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -32,7 +32,7 @@ testCompareXMLToArgvFiles(const char *xmlfile, g_autofree char *cmd =3D NULL; g_autofree char *log =3D NULL; int ret =3D -1; - virDomainDefPtr vmdef =3D NULL; + g_autoptr(virDomainDef) vmdef =3D NULL; =20 if (virTestLoadFile(cmdfile, &cmd) < 0) goto fail; @@ -86,7 +86,6 @@ testCompareXMLToArgvFiles(const char *xmlfile, ret =3D 0; =20 fail: - virDomainDefFree(vmdef); return ret; } =20 diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index ce2af08d4c..33e7ac5772 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -29,10 +29,10 @@ static int testCompareXMLToArgvFiles(const char *xml, g_autofree char *actualargv =3D NULL; g_autofree char *actualld =3D NULL; g_autofree char *actualdm =3D NULL; - virDomainDefPtr vmdef =3D NULL; - virCommandPtr cmd =3D NULL; - virCommandPtr ldcmd =3D NULL; - virConnectPtr conn; + g_autoptr(virDomainDef) vmdef =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; + g_autoptr(virCommand) ldcmd =3D NULL; + g_autoptr(virConnect) conn =3D NULL; int ret =3D -1; =20 if (!(conn =3D virGetConnect())) @@ -99,10 +99,6 @@ static int testCompareXMLToArgvFiles(const char *xml, vmdef->graphics[0]->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_VNC) virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port); =20 - virCommandFree(cmd); - virCommandFree(ldcmd); - virDomainDefFree(vmdef); - virObjectUnref(conn); return ret; } =20 --=20 2.26.2 From nobody Sat Apr 20 00:36:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) client-ip=63.128.21.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1595979897; cv=none; d=zohomail.com; s=zohoarc; b=XjNi1PK/VX8I7ejhmsrLZhwSdOa2t85WbMdndwWwO/CXkpBpdeiPKYxeBASFCs8Lb/uEHbC13kwV50xV7yjvMygBciK4Kbw80NBzKyH5Vd2S2ZAMKaKnxS94/bkz6o/4IArXOZ1LI2t6ZVjFXx7l5D3nN+Tl/ay0I3WrXtUJhrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595979897; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SvKw2NJgsFKqzRF6yOP7uMugmO3zUUlRR0xW49wRX1k=; b=NX08ulhPecdtlCLGKPz1tIlfPMGCQspOR7aSxMyf6OS3DcGSssrIE2HUYzIAejLRO+zJeT8USMG3XkJHFgj/QTDHBqO3Ssqg4ttzE+Hf0LyWw8b/f3LK3AE4imbZEsOgowa2p0Xc7okOvzwiaDXPuxbYBZJVCBZWcbFOGAzAvY8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by mx.zohomail.com with SMTPS id 1595979897027343.05129093287667; Tue, 28 Jul 2020 16:44:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-46-hfn7ZMqhPemSy002VRszWg-1; Tue, 28 Jul 2020 19:44:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A4225100A8C2; Tue, 28 Jul 2020 23:44:45 +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 83239712FF; Tue, 28 Jul 2020 23:44:45 +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 504361800FDE; Tue, 28 Jul 2020 23:44:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06SNieQU004496 for ; Tue, 28 Jul 2020 19:44:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1075D59; Tue, 28 Jul 2020 23:44:40 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78A7869327 for ; Tue, 28 Jul 2020 23:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595979895; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SvKw2NJgsFKqzRF6yOP7uMugmO3zUUlRR0xW49wRX1k=; b=XFCc6YmBHDI4hCx6gPB2SlIN9L0X3zOPf9Ifkf8jE2Zm2j9LYo6S1SUz/JG2WEQqQvkejs qZEj/hNkXdsIBLj2fmLbueZsks6t+YPAUJOhgpriVIUlLzOwW40TUHeUYN8ba0t3vGq/Jv 79RR0QXBTBbmHOHpnVSETmrHSvhVcBQ= X-MC-Unique: hfn7ZMqhPemSy002VRszWg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] tests: bhyve: remove unnecessary labels Date: Wed, 29 Jul 2020 01:44:27 +0200 Message-Id: <5f2f6546b9a1f5eed1c9d0b98169d361b30474e9.1595979850.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko Reviewed-by: Laine Stump Reviewed-by: Roman Bogorodskiy --- tests/bhyveargv2xmltest.c | 28 +++++++++++----------------- tests/bhyvexml2argvtest.c | 5 +---- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index e7ec3ae020..2a497f48e8 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -31,11 +31,10 @@ testCompareXMLToArgvFiles(const char *xmlfile, g_autofree char *actualxml =3D NULL; g_autofree char *cmd =3D NULL; g_autofree char *log =3D NULL; - int ret =3D -1; g_autoptr(virDomainDef) vmdef =3D NULL; =20 if (virTestLoadFile(cmdfile, &cmd) < 0) - goto fail; + return -1; =20 if (!(vmdef =3D bhyveParseCommandLineString(cmd, driver.bhyvecaps, driver.xmlopt))) { @@ -43,16 +42,16 @@ testCompareXMLToArgvFiles(const char *xmlfile, VIR_TEST_DEBUG("Got expected failure from " "bhyveParseCommandLineString."); } else { - goto fail; + return -1; } } else if ((flags & FLAG_EXPECT_FAILURE)) { VIR_TEST_DEBUG("Did not get expected failure from " "bhyveParseCommandLineString."); - goto fail; + return -1; } =20 if ((log =3D virTestLogContentAndReset()) =3D=3D NULL) - goto fail; + return -1; if (flags & FLAG_EXPECT_WARNING) { if (*log) { VIR_TEST_DEBUG("Got expected warning from " @@ -61,32 +60,29 @@ testCompareXMLToArgvFiles(const char *xmlfile, } else { VIR_TEST_DEBUG("bhyveParseCommandLineString " "should have logged a warning"); - goto fail; + return -1; } } else { /* didn't expect a warning */ if (*log) { VIR_TEST_DEBUG("Got unexpected warning from " "bhyveParseCommandLineString:\n%s", log); - goto fail; + return -1; } } =20 if (vmdef && !virDomainDefCheckABIStability(vmdef, vmdef, driver.xmlop= t)) { VIR_TEST_DEBUG("ABI stability check failed on %s", xmlfile); - goto fail; + return -1; } =20 if (vmdef && !(actualxml =3D virDomainDefFormat(vmdef, driver.xmlopt, = 0))) - goto fail; + return -1; =20 if (vmdef && virTestCompareToFile(actualxml, xmlfile) < 0) - goto fail; + return -1; =20 - ret =3D 0; - - fail: - return ret; + return 0; } =20 struct testInfo { @@ -97,7 +93,6 @@ struct testInfo { static int testCompareXMLToArgvHelper(const void *data) { - int result =3D -1; const struct testInfo *info =3D data; g_autofree char *xml =3D NULL; g_autofree char *args =3D NULL; @@ -107,8 +102,7 @@ testCompareXMLToArgvHelper(const void *data) args =3D g_strdup_printf("%s/bhyveargv2xmldata/bhyveargv2xml-%s.args", abs_srcdir, info->name); =20 - result =3D testCompareXMLToArgvFiles(xml, args, info->flags); - return result; + return testCompareXMLToArgvFiles(xml, args, info->flags); } =20 static int diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 33e7ac5772..7ce4dc6e58 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -110,7 +110,6 @@ struct testInfo { static int testCompareXMLToArgvHelper(const void *data) { - int ret =3D -1; const struct testInfo *info =3D data; g_autofree char *xml =3D NULL; g_autofree char *args =3D NULL; @@ -126,9 +125,7 @@ testCompareXMLToArgvHelper(const void *data) dmargs =3D g_strdup_printf("%s/bhyvexml2argvdata/bhyvexml2argv-%s.devm= ap", abs_srcdir, info->name); =20 - ret =3D testCompareXMLToArgvFiles(xml, args, ldargs, dmargs, info->fla= gs); - - return ret; + return testCompareXMLToArgvFiles(xml, args, ldargs, dmargs, info->flag= s); } =20 static int --=20 2.26.2