From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1626082538; cv=none; d=zohomail.com; s=zohoarc; b=OvvXesNf9UDBzzU/JTqh0de/uoJSIP7eztjgaasYn/hAnR9YtNHFB3idGEFJpjM4xp+Ox4AAHVB6Q/O/uZb3EtjGKlIaUo7SNGXO5PraG5ueIQrJu/bXBPBuSqTYI60Spz8/jka4IELvgLxp7cLeLPMptX2qaTINKZ4h7vWD1YI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082538; h=Content-Type:Content-Transfer-Encoding:Cc: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=WZCpGY/a2IVgtjwXkoZyYd5aDcUJHrjMJqrL7FMB3Wo=; b=Kh9QudpAShOr0iQsqW8w3h0m9fiO+s2DNtHuHu/pg4v54IhP3FIP4D9FKzIE2HIxxmWmU7elkGt88hIaCYTCgEXCe87TzQtJFiSy9nBz9MvzGjzsHOWwAHfl0g20mli2Kpc9pQvHeIysRb09ogux3GUKs+e4oA6bXCUrWpE24UA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1626082538494967.336870367644; Mon, 12 Jul 2021 02:35:38 -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-336-YevO1Pq2OAqKb_H_P1Q9Bw-1; Mon, 12 Jul 2021 05:35:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F2EDA802E65; Mon, 12 Jul 2021 09:35:30 +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 9C0681009962; Mon, 12 Jul 2021 09:35:30 +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 47F531809C9A; Mon, 12 Jul 2021 09:35:30 +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 16C9YMlN009767 for ; Mon, 12 Jul 2021 05:34:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B5305C22A; Mon, 12 Jul 2021 09:34:22 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B8515C1D1; Mon, 12 Jul 2021 09:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082537; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=WZCpGY/a2IVgtjwXkoZyYd5aDcUJHrjMJqrL7FMB3Wo=; b=gd/7duii5vd/z5ZRerjQITV3MrusbYuLd9b9VDTbW8IvfMK/qTiO4H82zhl5s5P2k4q1se vlGy0pdc2PrJUjY+bniFeV9UooTe/o40R5xLxdHxJtYKiazbRjaJ0aaogAe9Sn2oAsL37q tgRec02SU7IODES1tQH3aTWAIAwa1o0= X-MC-Unique: YevO1Pq2OAqKb_H_P1Q9Bw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] testCompareXMLToArgvFiles: `virHashNew` cannot return NULL Date: Mon, 12 Jul 2021 11:34:08 +0200 Message-Id: <20210712093417.12622-2-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.84 on 10.5.11.22 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082539174100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/nwfilterxml2firewalltest.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewallt= est.c index 6709cc15fd..1cde8e258e 100644 --- a/tests/nwfilterxml2firewalltest.c +++ b/tests/nwfilterxml2firewalltest.c @@ -376,9 +376,6 @@ static int testCompareXMLToArgvFiles(const char *xml, =20 virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL); =20 - if (!vars) - goto cleanup; - if (testSetDefaultParameters(vars) < 0) goto cleanup; =20 --=20 2.31.1 From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1626082655; cv=none; d=zohomail.com; s=zohoarc; b=QwzD4I9hJgkOdfZmJq3vAFGfWtSUdah1HGveLAqYRmKIMCdlA02hVka0LgZhiHqXCjx38STfevvKqGEhKnfCPQesO+EdJJq71vcJVpMfYtI0lLPsovd29DTUt/Bfdj0lxTt+CW85Q9tgfi5ogHwrcTKMR2HIarC0xMRXtrOimmc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082655; h=Content-Type:Content-Transfer-Encoding:Cc: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=uXw8bS/fXeIT1+3EiMORGuNijV6/HM9TO56nYEIDpUA=; b=YRCfWC9dLJYQb6ZeCsp3FV6e9SNzdLYy7j59PB1ij2fQfjWV1GF1JiH/m+L2J8sGNQxvGS+BOxG+yGxdGIjtGjXEPdMa9vg1ZZsZojRiMmMAZnijawlb3FYQJBFEnt5wPD0Kcczlgs8dRPd90FI1Me5SzYRLV4/Q/+9wUspfbno= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1626082655916292.15953947660705; Mon, 12 Jul 2021 02:37:35 -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-409-7-J4ZmsdN628jlXJSGB0tA-1; Mon, 12 Jul 2021 05:37:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 13BCF91270; Mon, 12 Jul 2021 09:37:28 +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 E9AEB60875; Mon, 12 Jul 2021 09:37:27 +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 A3AA14EA2A; Mon, 12 Jul 2021 09:37:27 +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 16C9YNOm009776 for ; Mon, 12 Jul 2021 05:34:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4BDE45C1D5; Mon, 12 Jul 2021 09:34:23 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B8B15C1D1; Mon, 12 Jul 2021 09:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082655; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=uXw8bS/fXeIT1+3EiMORGuNijV6/HM9TO56nYEIDpUA=; b=h9EZz+QrCopqlC2ODcaHaM9s1+C2jTp8sn8U+oUZGyAvqKtmGEzWBERpRcJsv49xffWC/C BSi3G90w65I2vPQgkE2a6AKmQgH4rv75sHlI0bZ4lUzodPMweq+BS4GFHXaj/RvfOyXjWC epVXVdyFpkF1Q1aZBrYzWQd51tIlebM= X-MC-Unique: 7-J4ZmsdN628jlXJSGB0tA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo: Use automatic memory management Date: Mon, 12 Jul 2021 11:34:09 +0200 Message-Id: <20210712093417.12622-3-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.13 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082656626100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/qemumonitorjsontest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index e6746b806f..e993c30c97 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1536,7 +1536,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInf= o(const void *opaque) { const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; - GHashTable *blockstats =3D NULL; + g_autoptr(GHashTable) blockstats =3D NULL; qemuBlockStats *stats; int ret =3D -1; g_autoptr(qemuMonitorTest) test =3D NULL; @@ -1688,7 +1688,6 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInf= o(const void *opaque) #undef CHECK0FULL =20 cleanup: - virHashFree(blockstats); return ret; } =20 --=20 2.31.1 From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1626082482; cv=none; d=zohomail.com; s=zohoarc; b=K0pAeiJQ7fGc+cB1BSVwaUJ39c4SHGYvFP5DLagx307MLkwCGVfn29uOA53aEqTtgctmQskrOxcAnDTkHkrFDufSk5s14mjETQovvENRsAfo2FkCJbZlUYayugmIEbV5LxGzyVlyRnGjwRhEwtAmJHj1koNJKugqwNeCN2DPB0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082482; h=Content-Type:Content-Transfer-Encoding:Cc: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=BzPDT4McrqVRZMOL3hRPgqrBYHhd1xOVLSRJNs9WI9s=; b=MnnPwrAhznsM8mB4E2eLveezd7c4qYQqr2LSN7Xb48sJcqz7skXexmyfA8r8p7UH/hAjjR9MAyD4L7kG6/xRTw0jhMCcDr8eywWiuQgoyZP+x+x2KtdYW6Vr9z30+UAqJ9i8stCrqNZNwWYeuGf8UIwZDoDHzfz24O9NDHHVOaQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1626082482673679.9851443147842; Mon, 12 Jul 2021 02:34:42 -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-518-lKqHDbesM76zCqZn217cOA-1; Mon, 12 Jul 2021 05:34:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 26CC919057A1; Mon, 12 Jul 2021 09:34:30 +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 F38951009962; Mon, 12 Jul 2021 09:34:29 +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 B94D04EA2A; Mon, 12 Jul 2021 09:34:29 +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 16C9YOmp009783 for ; Mon, 12 Jul 2021 05:34:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E5B75C1D5; Mon, 12 Jul 2021 09:34:24 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E3685C1D1; Mon, 12 Jul 2021 09:34:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082481; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=BzPDT4McrqVRZMOL3hRPgqrBYHhd1xOVLSRJNs9WI9s=; b=gl00QEyxAsfCqHpFdXtkYkC3OLIF+0C5v+n4wRWBJR89WfYjMbH06dPUvMcIOtcH91TXwW G7rqlSioqoo4RMU3rZouSPX3G/Btr9mQr/ErEWhOOvpzbxHyTyJO6vvyGMMD+heLuxhH9U 7uKuk+yVEHT6u++M3SiZhxrKNrxX9Ig= X-MC-Unique: lKqHDbesM76zCqZn217cOA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo: Remove superfluous `goto`s Date: Mon, 12 Jul 2021 11:34:10 +0200 Message-Id: <20210712093417.12622-4-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.84 on 10.5.11.22 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082484587100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/qemumonitorjsontest.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index e993c30c97..b1332eb1df 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1538,7 +1538,6 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInf= o(const void *opaque) virDomainXMLOption *xmlopt =3D data->xmlopt; g_autoptr(GHashTable) blockstats =3D NULL; qemuBlockStats *stats; - int ret =3D -1; g_autoptr(qemuMonitorTest) test =3D NULL; =20 const char *reply =3D @@ -1632,10 +1631,10 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsI= nfo(const void *opaque) return -1; =20 if (!(blockstats =3D virHashNew(g_free))) - goto cleanup; + return -1; =20 if (qemuMonitorTestAddItem(test, "query-blockstats", reply) < 0) - goto cleanup; + return -1; =20 #define CHECK0FULL(var, value, varformat, valformat) \ if (stats->var !=3D value) { \ @@ -1643,7 +1642,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInf= o(const void *opaque) "Invalid " #var " value: " varformat \ ", expected " valformat, \ stats->var, value); \ - goto cleanup; \ + return -1; \ } =20 #define CHECK0(var, value) CHECK0FULL(var, value, "%lld", "%d") @@ -1654,7 +1653,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInf= o(const void *opaque) if (!(stats =3D virHashLookup(blockstats, NAME))) { \ virReportError(VIR_ERR_INTERNAL_ERROR, \ "block stats for device '%s' is missing", NAME); \ - goto cleanup; \ + return -1; \ } \ CHECK0(rd_req, RD_REQ) \ CHECK0(rd_bytes, RD_BYTES) \ @@ -1669,26 +1668,24 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsI= nfo(const void *opaque) =20 if (qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitorTestGetMonitor(test= ), blockstats, false) < 0) - goto cleanup; + return -1; =20 if (!blockstats) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "qemuMonitorJSONGetAllBlockStatsInfo didn't return = stats"); - goto cleanup; + return -1; } =20 CHECK("virtio-disk0", 1279, 28505088, 640616474, 174, 2845696, 5306992= 21, 0, 0, 5256018944ULL, true) CHECK("virtio-disk1", 85, 348160, 8232156, 0, 0, 0, 0, 0, 0ULL, true) CHECK("ide0-1-0", 16, 49250, 1004952, 0, 0, 0, 0, 0, 0ULL, false) =20 - ret =3D 0; + return 0; =20 #undef CHECK #undef CHECK0 #undef CHECK0FULL =20 - cleanup: - return ret; } =20 =20 --=20 2.31.1 From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1626082661; cv=none; d=zohomail.com; s=zohoarc; b=UlcjrzKn/94Ak84Uds3fdXo8E1VcV+z7MQInEUhoPu1XfsY991uGCTqaLX1IM5KLlktCDJ6QMqHnl+HuFpOPsYQVYcuxtic6clqqx759FMvRRYDOntc2aCMobtvGVMYONZE9a9VRSs3Df62giPiE90mCypxOU37q3wjTydXvYyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082661; h=Content-Type:Content-Transfer-Encoding:Cc: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=LjJyX0eE/V54hYBual88gqnpg6WD4TfafM1QzL3F5a0=; b=AZ0SlaUxrxk77tOdJWCKNstbGI9s/KUcCENzIL+uk5tEYJTcqD6u/fSoobFHaUC7XnduJwyGCvkQWwtsfpacZVsYN2zHMJrEP2xlaX3DATWcwoDA4X9QZBqQGizJ5Go7qs3nXKKZNK+4BmgDK+vuKYX5tR5b5cHVwI6xw0JLIq0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1626082661087363.41977327855113; Mon, 12 Jul 2021 02:37:41 -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-230-BERoGOFCP9qnRbaDRsI1oA-1; Mon, 12 Jul 2021 05:37:38 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7824804302; Mon, 12 Jul 2021 09:37:33 +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 AA47C60875; Mon, 12 Jul 2021 09:37:33 +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 6EF6D4EA38; Mon, 12 Jul 2021 09:37:33 +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 16C9YP0q009788 for ; Mon, 12 Jul 2021 05:34:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4EFED5C1D5; Mon, 12 Jul 2021 09:34:25 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EBD95C1D1; Mon, 12 Jul 2021 09:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082660; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=LjJyX0eE/V54hYBual88gqnpg6WD4TfafM1QzL3F5a0=; b=NEenk0dlOyIBkilbTUQHaGEHGFt7peAm84xRxnSC3iTuqpJ4zJyejqyXyNEnOPFj93B5M1 +VnIorkFI87H0KFd37yh2uY16XEpPiALjsreoa0+zcT546LRYe6dqcG4gxFE6ECWXmzxnp G0iG2YOh71n1YZqQGWEcGc6PicVHqLw= X-MC-Unique: BERoGOFCP9qnRbaDRsI1oA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInfo: `virHashNew` cannot return NULL Date: Mon, 12 Jul 2021 11:34:11 +0200 Message-Id: <20210712093417.12622-5-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.13 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082663216100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/qemumonitorjsontest.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index b1332eb1df..8895c7305f 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1536,7 +1536,7 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInf= o(const void *opaque) { const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; - g_autoptr(GHashTable) blockstats =3D NULL; + g_autoptr(GHashTable) blockstats =3D virHashNew(g_free); qemuBlockStats *stats; g_autoptr(qemuMonitorTest) test =3D NULL; =20 @@ -1630,9 +1630,6 @@ testQemuMonitorJSONqemuMonitorJSONGetAllBlockStatsInf= o(const void *opaque) if (!(test =3D qemuMonitorTestNewSchema(xmlopt, data->schema))) return -1; =20 - if (!(blockstats =3D virHashNew(g_free))) - return -1; - if (qemuMonitorTestAddItem(test, "query-blockstats", reply) < 0) return -1; =20 --=20 2.31.1 From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1626082664; cv=none; d=zohomail.com; s=zohoarc; b=I8RXH01kKrZcGKXgUTCSWxu/9ouO/gRu+gQN9dANpypT/zgeQw9zAFwfEGXr6OfmZ88huR187raKWfJBFkQRmKGlfmx3VHRn5PT7tlwG1OuqGjs2hQNDOyd4IKhIizjQpVFaJH4M8LWgkUb2wYNawe0L/xVy6IY2JEabPjwf9oc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082664; h=Content-Type:Content-Transfer-Encoding:Cc: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=GyRZy4s3g3aPEf48IQgO5i0SK7CiskxFQCpeluNw5ts=; b=ZIpKW2r75zz1RokyTdQLj2H1M6i2pOly1zxlGhdkOHJBI5cSGvBRUpFy8OPZI1pyQ9HSuY63PqtrQiQmkLfCHPg8C80PrkH5W5G4Gwc/gWBHOGpXqfaY2fHsathekMR0KaT6+5k5OgXDfoVYN5r3v1Qys+TG6ErvesTozwzrJqA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1626082664412249.62710766060457; Mon, 12 Jul 2021 02:37:44 -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-298-umujJ2AnPIyUAVyJy9YmOg-1; Mon, 12 Jul 2021 05:37:41 -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 D712E804143; Mon, 12 Jul 2021 09:37:36 +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 AED3B5D6BA; Mon, 12 Jul 2021 09:37:36 +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 7A1A54EA3A; Mon, 12 Jul 2021 09:37:36 +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 16C9YQE7009804 for ; Mon, 12 Jul 2021 05:34:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E4495C1D1; Mon, 12 Jul 2021 09:34:26 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E55A5C1D5; Mon, 12 Jul 2021 09:34:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082663; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=GyRZy4s3g3aPEf48IQgO5i0SK7CiskxFQCpeluNw5ts=; b=Bz6sG3gS4ZqG1DKSaGZpmjo8uFoNfPHOoo2y6fP9luR4VQV87JacNwl+Gf7+2+zgF+Bchw ucdTN9DBANKmsgRhVdzTDzrWzFh0SYAnWG8yyzl2c/xBlgVHu5TilAu5JmFwnixOBQSM5s B6RXEm8FdSHrpa7C5zQjgWBv4V1D8z8= X-MC-Unique: umujJ2AnPIyUAVyJy9YmOg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] testQemuMonitorJSONqemuMonitorJSONGetBlockInfo: Use automatic memory management Date: Mon, 12 Jul 2021 11:34:12 +0200 Message-Id: <20210712093417.12622-6-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082665400100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/qemumonitorjsontest.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 8895c7305f..e4a907e5b6 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1461,8 +1461,8 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const = void *opaque) const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; int ret =3D -1; - GHashTable *blockDevices =3D NULL; - GHashTable *expectedBlockDevices =3D NULL; + g_autoptr(GHashTable) blockDevices =3D NULL; + g_autoptr(GHashTable) expectedBlockDevices =3D NULL; struct qemuDomainDiskInfo *info; g_autoptr(qemuMonitorTest) test =3D NULL; =20 @@ -1526,8 +1526,6 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const = void *opaque) =20 ret =3D 0; cleanup: - virHashFree(blockDevices); - virHashFree(expectedBlockDevices); return ret; } =20 --=20 2.31.1 From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1626082544; cv=none; d=zohomail.com; s=zohoarc; b=WEsqFFXTDQjirw3PI3P6kML9AKIi78QyaIYBMG/W+awvkFihoFwJ/lME/CrcqvSAa+Xk1glPGzKopPv/Hx1HlBX6PWlmzPPLFaYXp8pM7Y3z+pyg4MAC7t34Jhxuoy3TdFZ3ZFV6DwxID0z6q1SNB1FiZKAXsH1JtFOsy1lcKPw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082544; h=Content-Type:Content-Transfer-Encoding:Cc: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=LcntLxn5keWkz7UF0EOwMSQvDr+SJjISpaTunFj3c2Q=; b=ewmyS+ylvS0ehQaARxcm1dCRYNw/nkEPOwecPl2daJIyvvDLh+aXfOjPnnQjPYVHZrGqT8jESdkbXheo/Aa9/WarYl6qOPBVbziUkqBIkAnBdqhrxmsAqlCqAzn7a47EKzkIOgHAWLQ4Ym6QUHOZpSZYToFU4OI/CbJ/4r6mcN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1626082544013891.3945148106977; Mon, 12 Jul 2021 02:35:44 -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-287-mKSlBTScMzGkSHkCekt4_g-1; Mon, 12 Jul 2021 05:35:41 -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 D99C019057A1; Mon, 12 Jul 2021 09:35:35 +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 B6C2060CCC; Mon, 12 Jul 2021 09:35:35 +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 45D701809CB3; Mon, 12 Jul 2021 09:35:35 +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 16C9YRB7009813 for ; Mon, 12 Jul 2021 05:34:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E1055C22A; Mon, 12 Jul 2021 09:34:27 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E5BB5C1D1; Mon, 12 Jul 2021 09:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082543; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=LcntLxn5keWkz7UF0EOwMSQvDr+SJjISpaTunFj3c2Q=; b=YFgo3CkL1NnrxamV3uMU3mn9hB1dsVy1HxYIQ66YPu7X26NqOQhN0v/jffB+4j6/5/PG7H VcPKoZpPE1jOl6TblP4rblrWXCAcrJkzbDeQ53890R1CXJO4xYAzxPS8tX3AmT8/0JcEip 8uKwlSDxOQjM6RULlira6he2GAO5tIs= X-MC-Unique: mKSlBTScMzGkSHkCekt4_g-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] testQemuMonitorJSONqemuMonitorJSONGetBlockInfo: Remove superfluous `goto`s Date: Mon, 12 Jul 2021 11:34:13 +0200 Message-Id: <20210712093417.12622-7-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082545728100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/qemumonitorjsontest.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index e4a907e5b6..7fd58dc2d1 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1460,7 +1460,6 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const = void *opaque) { const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; - int ret =3D -1; g_autoptr(GHashTable) blockDevices =3D NULL; g_autoptr(GHashTable) expectedBlockDevices =3D NULL; struct qemuDomainDiskInfo *info; @@ -1471,14 +1470,14 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(cons= t void *opaque) =20 if (!(blockDevices =3D virHashNew(g_free)) || !(expectedBlockDevices =3D virHashNew(g_free))) - goto cleanup; + return -1; =20 info =3D g_new0(struct qemuDomainDiskInfo, 1); =20 if (virHashAddEntry(expectedBlockDevices, "virtio-disk0", info) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Unable to create expectedBlockDevices hash table"); - goto cleanup; + return -1; } =20 info =3D g_new0(struct qemuDomainDiskInfo, 1); @@ -1486,7 +1485,7 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const = void *opaque) if (virHashAddEntry(expectedBlockDevices, "virtio-disk1", info) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Unable to create expectedBlockDevices hash table"); - goto cleanup; + return -1; } =20 info =3D g_new0(struct qemuDomainDiskInfo, 1); @@ -1497,7 +1496,7 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const = void *opaque) if (virHashAddEntry(expectedBlockDevices, "ide0-1-0", info) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Unable to create expectedBlockDevices hash table"); - goto cleanup; + return -1; } =20 info =3D g_new0(struct qemuDomainDiskInfo, 1); @@ -1509,24 +1508,22 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(cons= t void *opaque) if (virHashAddEntry(expectedBlockDevices, "ide0-1-1", info) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Unable to create expectedBlockDevices hash table"); - goto cleanup; + return -1; } =20 if (qemuMonitorTestAddItem(test, "query-block", queryBlockReply) < 0) - goto cleanup; + return -1; =20 if (qemuMonitorJSONGetBlockInfo(qemuMonitorTestGetMonitor(test), block= Devices) < 0) - goto cleanup; + return -1; =20 if (!virHashEqual(blockDevices, expectedBlockDevices, testHashEqualQem= uDomainDiskInfo)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Hashtable is different to the expected one"); - goto cleanup; + return -1; } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 static int --=20 2.31.1 From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1626082546; cv=none; d=zohomail.com; s=zohoarc; b=EQxUjho5Gu17kL0I+c8a145Tkxntt5yWKpryXSNnzxlViNVSuoGIa8eR1EgyfB8gtXLZxT0XJCnWPMNEGuwUW1cQ/YiOqQAw+/TQmHxQR3Q1XgRYxd4f270kz728PTcI11B5EiAcaTUUcV6+vi+9tv29uYdLaWKj2H7Jbzn54FQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082546; h=Content-Type:Content-Transfer-Encoding:Cc: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=UP5dzWFNX+WKCulfT29jB593znqFhsmhgDvU6Z//fbc=; b=I88BJwHOwFkVx19QX7O8KSUJ6Soa37YXROBh9FgJL5uAFsCVivN5pcCNqVDv8cPybEcGNRaILAiUgJ7YzuH8c/2WwCR50Jaw99086QlYHB/53wEVec5BGS2qHUezh+DoQlj9jeljEqy2KXrKcV5EfRu3WPrr70u1slJonRBbatI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1626082546942875.1261418942717; Mon, 12 Jul 2021 02:35:46 -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-474-F68ANLxON6CK0Vs03AXZzQ-1; Mon, 12 Jul 2021 05:35:44 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F84B804140; Mon, 12 Jul 2021 09:35:39 +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 0E47B5DD86; Mon, 12 Jul 2021 09:35:39 +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 CC7B84EA2A; Mon, 12 Jul 2021 09:35:38 +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 16C9YSu2009830 for ; Mon, 12 Jul 2021 05:34:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 503525C22A; Mon, 12 Jul 2021 09:34:28 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F5C85C1D1; Mon, 12 Jul 2021 09:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082545; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=UP5dzWFNX+WKCulfT29jB593znqFhsmhgDvU6Z//fbc=; b=YptPRKF/WmKk6yndJojV24pqNIIaT5OoeAS5x+xB9qSJjV4SRuIMQ+iXInY25+HUlMa/xG U6ddhtQJ+eGEU+e8dEYtG4wN7cIMC9R4PYY6pRKv/jplK3isz+8TESM9xdZJwrZbmEhiRr kQAgxpfjR3LQDG5Tbgw5mrWbdugb6N4= X-MC-Unique: F68ANLxON6CK0Vs03AXZzQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] testQemuMonitorJSONqemuMonitorJSONGetBlockInfo: `virHashNew` cannot return NULL Date: Mon, 12 Jul 2021 11:34:14 +0200 Message-Id: <20210712093417.12622-8-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.14 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082547991100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/qemumonitorjsontest.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 7fd58dc2d1..89ede3b59a 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1460,18 +1460,14 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(cons= t void *opaque) { const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; - g_autoptr(GHashTable) blockDevices =3D NULL; - g_autoptr(GHashTable) expectedBlockDevices =3D NULL; + g_autoptr(GHashTable) blockDevices =3D virHashNew(g_free); + g_autoptr(GHashTable) expectedBlockDevices =3D virHashNew(g_free); struct qemuDomainDiskInfo *info; g_autoptr(qemuMonitorTest) test =3D NULL; =20 if (!(test =3D qemuMonitorTestNewSchema(xmlopt, data->schema))) return -1; =20 - if (!(blockDevices =3D virHashNew(g_free)) || - !(expectedBlockDevices =3D virHashNew(g_free))) - return -1; - info =3D g_new0(struct qemuDomainDiskInfo, 1); =20 if (virHashAddEntry(expectedBlockDevices, "virtio-disk0", info) < 0) { --=20 2.31.1 From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1626082550; cv=none; d=zohomail.com; s=zohoarc; b=k+LbahYaRRS6QsDN1x4u7JC8SUQVzQnnXoH9004kmEx5JM2rWj1Bv4DDnT10AYlY2oNCpPbQNlZpN5XobyI/18h+T4A3CcCRObHB8PoZ33Iq+UtZ6i2e9tQwiIDCaEOnkGR5eq2+uLnWZOKxng4KSAXKDM2QTmkYco0UlQpRUHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082550; h=Content-Type:Content-Transfer-Encoding:Cc: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=6WmiEoeWsSepv91GfXHdk/KvOmzf4Hyj6gh6TglKsi0=; b=L5ddEXp/uf3N7FHvXhg+/C76lZ4rPzfN8jXt9YrN23++cdiHI1YzA9rsUnvqBoFbwqRgsVRaQ/qku0Vap+KxbgTE08ZU93o6fNaOpHX3NbspQRD3x1iyo0AG2yeaXiKLGLeBlakLOpe5VXqBMmiTCh7T6mTr1QKPqWdyrFvRmJM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1626082549996446.4645691378174; Mon, 12 Jul 2021 02:35:49 -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-97-ckYCOq_bNJihVkPnk7XUvA-1; Mon, 12 Jul 2021 05:35:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 287E76127B; Mon, 12 Jul 2021 09:35:42 +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 0B5B360875; Mon, 12 Jul 2021 09:35:42 +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 CD82A4EA38; Mon, 12 Jul 2021 09:35: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 16C9YT2W009838 for ; Mon, 12 Jul 2021 05:34:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5007F5C22A; Mon, 12 Jul 2021 09:34:29 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F85F5C1D1; Mon, 12 Jul 2021 09:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082549; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=6WmiEoeWsSepv91GfXHdk/KvOmzf4Hyj6gh6TglKsi0=; b=J83uzXTybtQnuwuzh6P0k3zia5RBu1gHE7NPlFJrXrrCR9nUU70YoAI4Xz1b0HvmYHyHSc piKmsc5qoIZwSyrcKr41dqZL0fHwTYSG715MzcDigf3pGlK0pwyBO1XYRT1NrSUXAVt96H LeSfRPEt6VTPXB0Zg3cKjHizz+6qYYw= X-MC-Unique: ckYCOq_bNJihVkPnk7XUvA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] testQemuMonitorJSONqemuMonitorJSONGetChardevInfo: Use automatic memory management Date: Mon, 12 Jul 2021 11:34:15 +0200 Message-Id: <20210712093417.12622-9-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.13 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082550277100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/qemumonitorjsontest.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 89ede3b59a..89ace3bb33 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1812,8 +1812,8 @@ testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(cons= t void *opaque) const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; int ret =3D -1; - GHashTable *info =3D NULL; - GHashTable *expectedInfo =3D NULL; + g_autoptr(GHashTable) info =3D NULL; + g_autoptr(GHashTable) expectedInfo =3D NULL; qemuMonitorChardevInfo info0 =3D { NULL, VIR_DOMAIN_CHR_DEVICE_STATE_D= EFAULT }; qemuMonitorChardevInfo info1 =3D { (char *) "/dev/pts/21", VIR_DOMAIN_= CHR_DEVICE_STATE_CONNECTED }; qemuMonitorChardevInfo info2 =3D { (char *) "/dev/pts/20", VIR_DOMAIN_= CHR_DEVICE_STATE_DEFAULT }; @@ -1874,8 +1874,6 @@ testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(cons= t void *opaque) =20 ret =3D 0; cleanup: - virHashFree(info); - virHashFree(expectedInfo); return ret; } =20 --=20 2.31.1 From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1626082553; cv=none; d=zohomail.com; s=zohoarc; b=go23F0NH+UyZaOI7jC6u/wGV6NgCBbEoLMXknw3Lf5N7fow0diUnJwaGz60CYoHFYwlfr5ZwBLQIKJLl/LxLiEkrcFZpwFTr0y7WlBIUn7tGbG93bCslWjyH4prFby8gEqeKyH7Tr8eY0Fv7L3Iy2WKfKBakepk8pspqTqTYuJE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082553; h=Content-Type:Content-Transfer-Encoding:Cc: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=Fz79OY9jVcmF6C93eE5JYSLHk6+27RY22ftnSfWgy7I=; b=P7uGZOuAAl+xrSdCaUaQLdMWSr0cYMM92ja8BvZAq6Ij3dP4lHP4p6fB89Y8HkFqW1ZWnjXj6+1nxGPeOHiyyIk4RBz9MHlNYzAqUjLszPb2FqDJeDeZSMPYJojCgrUWoxp40k3glRKiLTaDww4w30bvhDXD+R6tsXCT5DuU9Vw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1626082553282932.1476578998418; Mon, 12 Jul 2021 02:35:53 -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-30-Nn4B6eEgMumsi0gMMpgfUA-1; Mon, 12 Jul 2021 05:35:50 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3236280414C; Mon, 12 Jul 2021 09:35:45 +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 0B24610016F8; Mon, 12 Jul 2021 09:35: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 C29354EA3A; Mon, 12 Jul 2021 09:35:44 +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 16C9YUVv009852 for ; Mon, 12 Jul 2021 05:34:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 50C0D5C22A; Mon, 12 Jul 2021 09:34:30 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id A00A45C1D1; Mon, 12 Jul 2021 09:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082551; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Fz79OY9jVcmF6C93eE5JYSLHk6+27RY22ftnSfWgy7I=; b=ODq0Nr1gruWvTLVVAUkwWoXhqayrdovA1rSGi1HwGknLRekBs74oejNOkUEZeKQmxvyQTN UWP+PY7kZPB4uDBl0Y1/Za+JIIm6kmtLe/9HI1lh9Gk2QQhw/bAoOdDxZPWP+QSRsGJMA5 UHM85WqvYWqPJAPQKqt1/ew7hFKJjlc= X-MC-Unique: Nn4B6eEgMumsi0gMMpgfUA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] testQemuMonitorJSONqemuMonitorJSONGetChardevInfo: Remove superfluous `goto`s Date: Mon, 12 Jul 2021 11:34:16 +0200 Message-Id: <20210712093417.12622-10-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.84 on 10.5.11.22 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082554400100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/qemumonitorjsontest.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 89ace3bb33..37d878b0ad 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1811,7 +1811,6 @@ testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(cons= t void *opaque) { const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; - int ret =3D -1; g_autoptr(GHashTable) info =3D NULL; g_autoptr(GHashTable) expectedInfo =3D NULL; qemuMonitorChardevInfo info0 =3D { NULL, VIR_DOMAIN_CHR_DEVICE_STATE_D= EFAULT }; @@ -1825,7 +1824,7 @@ testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(cons= t void *opaque) =20 if (!(info =3D virHashNew(qemuMonitorChardevInfoFree)) || !(expectedInfo =3D virHashNew(NULL))) - goto cleanup; + return -1; =20 if (virHashAddEntry(expectedInfo, "charserial1", &info1) < 0 || virHashAddEntry(expectedInfo, "charserial0", &info2) < 0 || @@ -1833,7 +1832,7 @@ testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(cons= t void *opaque) virHashAddEntry(expectedInfo, "charserial2", &info3) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Unable to create expectedInfo hash table"); - goto cleanup; + return -1; } =20 if (qemuMonitorTestAddItem(test, "query-chardev", @@ -1860,21 +1859,19 @@ testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(co= nst void *opaque) " ]," " \"id\": \"libvirt-15\"" "}") < 0) - goto cleanup; + return -1; =20 if (qemuMonitorJSONGetChardevInfo(qemuMonitorTestGetMonitor(test), info) < 0) - goto cleanup; + return -1; =20 if (!virHashEqual(info, expectedInfo, testHashEqualChardevInfo)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", "Hashtable is different to the expected one"); - goto cleanup; + return -1; } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 --=20 2.31.1 From nobody Fri May 17 10:44:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1626082635; cv=none; d=zohomail.com; s=zohoarc; b=COrIRca2LN0kUqIdAIeyCd3Cffx2plaSOVhov5/0bTq2ZiDK7zNX9fadb/FvOZJY8Q2pSOoWLU3jT2h6qPmqnegwildK5C/LTleIuUY1tfNDoNfUFvXSa+NgCiruZkpU1O9jAaGBiaFu4g0+f5wATWdc5qy8gyfuaSynYCJxQ+c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1626082635; h=Content-Type:Content-Transfer-Encoding:Cc: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=4woCbdRUoH6ih+0Sf6+1DvxZcn+5eG1uy25sP0MiVts=; b=bBG6pnPpqFALqogd9QqhiJnWLM85Zg736zRHtiyINJ9oc7oPru3R9nvOTtEGgyCNqpNCoTr0BIEyDJ6aolWAWph5FprjvlD1e3OFw/mDVgeVV4d1MWvM2HEIfHJWUcCtf21eWZ0zN6yQh0FAlSt5JKsEJqLJznO12Qa/xUXsJg0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1626082635163855.4994264796441; Mon, 12 Jul 2021 02:37:15 -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-62-zbsn-OcAMKaWNZpK1j3HEA-1; Mon, 12 Jul 2021 05:35:55 -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 EB103804140; Mon, 12 Jul 2021 09:35:49 +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 D70F161093; Mon, 12 Jul 2021 09:35:47 +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 9F1FE4EA3D; Mon, 12 Jul 2021 09:35:47 +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 16C9YVlu009860 for ; Mon, 12 Jul 2021 05:34:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 510965C1D5; Mon, 12 Jul 2021 09:34:31 +0000 (UTC) Received: from work.speedport.ip (ovpn-113-134.ams2.redhat.com [10.36.113.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id A16EB5C1D1; Mon, 12 Jul 2021 09:34:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626082634; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=4woCbdRUoH6ih+0Sf6+1DvxZcn+5eG1uy25sP0MiVts=; b=RwFMkl8tLJI0KTjtW5Nc/vCXSltWNV1EiHpFA+1dOczp9XmI9CaWHpiKDczfgqDc6qv+Ee H1J17/Ikt8nJ0gC+JFN6P/ufhpSraKyyiXyINSOIle1BFNkJhKkwsseiGbhKWTkfrURwjv 3+vasSeZqVy82tvmWexrPRZhL4x8r20= X-MC-Unique: zbsn-OcAMKaWNZpK1j3HEA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] testQemuMonitorJSONqemuMonitorJSONGetChardevInfo: `virHashNew` cannot return NULL Date: Mon, 12 Jul 2021 11:34:17 +0200 Message-Id: <20210712093417.12622-11-twiederh@redhat.com> In-Reply-To: <20210712093417.12622-1-twiederh@redhat.com> References: <20210712093417.12622-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1626082636988100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- tests/qemumonitorjsontest.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 37d878b0ad..0b321e8ed8 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1811,8 +1811,8 @@ testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(cons= t void *opaque) { const testGenericData *data =3D opaque; virDomainXMLOption *xmlopt =3D data->xmlopt; - g_autoptr(GHashTable) info =3D NULL; - g_autoptr(GHashTable) expectedInfo =3D NULL; + g_autoptr(GHashTable) info =3D virHashNew(qemuMonitorChardevInfoFree); + g_autoptr(GHashTable) expectedInfo =3D virHashNew(NULL); qemuMonitorChardevInfo info0 =3D { NULL, VIR_DOMAIN_CHR_DEVICE_STATE_D= EFAULT }; qemuMonitorChardevInfo info1 =3D { (char *) "/dev/pts/21", VIR_DOMAIN_= CHR_DEVICE_STATE_CONNECTED }; qemuMonitorChardevInfo info2 =3D { (char *) "/dev/pts/20", VIR_DOMAIN_= CHR_DEVICE_STATE_DEFAULT }; @@ -1822,10 +1822,6 @@ testQemuMonitorJSONqemuMonitorJSONGetChardevInfo(con= st void *opaque) if (!(test =3D qemuMonitorTestNewSchema(xmlopt, data->schema))) return -1; =20 - if (!(info =3D virHashNew(qemuMonitorChardevInfoFree)) || - !(expectedInfo =3D virHashNew(NULL))) - return -1; - if (virHashAddEntry(expectedInfo, "charserial1", &info1) < 0 || virHashAddEntry(expectedInfo, "charserial0", &info2) < 0 || virHashAddEntry(expectedInfo, "charmonitor", &info0) < 0 || --=20 2.31.1