From nobody Fri Mar 29 12:34:06 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 1637244147759574.4104774612067; Thu, 18 Nov 2021 06:02:27 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-204-xMUPekg0NNCgabz7SZYuuw-1; Thu, 18 Nov 2021 09:02:23 -0500 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 E202A1006AAA; Thu, 18 Nov 2021 14:02:17 +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 C1FED1037F46; Thu, 18 Nov 2021 14:02:17 +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 8EC911832DD4; Thu, 18 Nov 2021 14:02:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIE08Mv010918 for ; Thu, 18 Nov 2021 09:00:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 661D12026D69; Thu, 18 Nov 2021 14:00:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FFC12026D64 for ; Thu, 18 Nov 2021 14:00:04 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 303928027FB for ; Thu, 18 Nov 2021 14:00:04 +0000 (UTC) Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-215-DqbknSbqO5qtLJDYNYZ4Iw-1; Thu, 18 Nov 2021 09:00:02 -0500 Received: by mail-qt1-f176.google.com with SMTP id p19so6030896qtw.12 for ; Thu, 18 Nov 2021 06:00:01 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id e7sm1542168qtx.72.2021.11.18.06.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:00:00 -0800 (PST) X-MC-Unique: xMUPekg0NNCgabz7SZYuuw-1 X-MC-Unique: DqbknSbqO5qtLJDYNYZ4Iw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mA27AJzURwjRp8EkXHOeraDBXGwrYwvhJW7jPmp/DyI=; b=iQ5MB98wR1yAWRk46kDVgMc+bOIwaRNQoeIjPBSGiuZGPTuhwhuirq81bTLn0s+Pow RJOsWdHnx5gMM3F1jFigS+9tkpyRhkhi7nZ+6Lt5nwqht0durgIoVhMS/ZmBO+/ZY6q3 v4Qn6g4DAD0smpHv/tPFYbgJKbOqgapFI0r2Mj6OvlrZyvSKTwQ8jhPIUP2epH4p9gEV rbNccPmU8WeDnY2r87et5tUVi7hKnl8JRTEbyADJ4mOdfKwQaME8Bmxna11kvlMJOuhB WOKc0GYZzOuYnuUuKuzN0QQ39jAkxi+SHFZKkaKeNPOLYpeoNt+U9IZX7RPH5KHujJ7T NlwA== X-Gm-Message-State: AOAM530q1VcvKbKFC/qmb3aZd8a3nmLButCneN1YA2LhRoFYAkihDlam 9jSBJnoVdd5KJW0DXL11NLwYTu6kU+R63g== X-Google-Smtp-Source: ABdhPJxYqtOvEa8xmUuB3QpC1vATu2Fq+jwrcXhgoTiK3skIabM163srib4b2U88LYcYLnlGywMyPw== X-Received: by 2002:a05:622a:1705:: with SMTP id h5mr26536822qtk.331.1637244001068; Thu, 18 Nov 2021 06:00:01 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 1/7] qemu_capabilities.c: use g_autofree in virQEMUCapsLoadCache() Date: Thu, 18 Nov 2021 10:59:38 -0300 Message-Id: <20211118135944.272979-2-danielhb413@gmail.com> In-Reply-To: <20211118135944.272979-1-danielhb413@gmail.com> References: <20211118135944.272979-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: danielh413@gmail.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.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-ZM-MESSAGEID: 1637244190640100001 Content-Type: text/plain; charset="utf-8" Use autofree with 'str' and 'nodes' to get rid of the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c | 66 ++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 36 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 67fae46a34..aef76ecc56 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4125,20 +4125,19 @@ virQEMUCapsLoadCache(virArch hostArch, bool skipInvalidation) { g_autoptr(xmlDoc) doc =3D NULL; - int ret =3D -1; size_t i; int n; - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; g_autoptr(xmlXPathContext) ctxt =3D NULL; - char *str =3D NULL; + g_autofree char *str =3D NULL; long long int l; unsigned long lu; =20 if (!(doc =3D virXMLParseFile(filename))) - goto cleanup; + return -1; =20 if (!(ctxt =3D virXMLXPathContextNew(doc))) - goto cleanup; + return -1; =20 ctxt->node =3D xmlDocGetRootElement(doc); =20 @@ -4147,13 +4146,13 @@ virQEMUCapsLoadCache(virArch hostArch, _("unexpected root element <%s>, " "expecting "), ctxt->node->name); - goto cleanup; + return -1; } =20 if (virXPathLongLong("string(./selfctime)", ctxt, &l) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing selfctime in QEMU capabilities XML")); - goto cleanup; + return -1; } qemuCaps->libvirtCtime =3D (time_t)l; =20 @@ -4171,26 +4170,25 @@ virQEMUCapsLoadCache(virArch hostArch, (long long)virGetSelfLastChanged(), (unsigned long)qemuCaps->libvirtVersion, (unsigned long)LIBVIR_VERSION_NUMBER); - ret =3D 1; - goto cleanup; + return 1; } =20 if (!(str =3D virXPathString("string(./emulator)", ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing emulator in QEMU capabilities cache")); - goto cleanup; + return -1; } if (STRNEQ(str, qemuCaps->binary)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Expected caps for '%s' but saw '%s'"), qemuCaps->binary, str); - goto cleanup; + return -1; } VIR_FREE(str); if (virXPathLongLong("string(./qemuctime)", ctxt, &l) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing qemuctime in QEMU capabilities XML")); - goto cleanup; + return -1; } qemuCaps->ctime =3D (time_t)l; =20 @@ -4200,7 +4198,7 @@ virQEMUCapsLoadCache(virArch hostArch, if ((n =3D virXPathNodeSet("./flag", ctxt, &nodes)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to parse qemu capabilities flags")); - goto cleanup; + return -1; } VIR_DEBUG("Got flags %d", n); for (i =3D 0; i < n; i++) { @@ -4208,13 +4206,13 @@ virQEMUCapsLoadCache(virArch hostArch, if (!(str =3D virXMLPropString(nodes[i], "name"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing flag name in QEMU capabilities cache= ")); - goto cleanup; + return -1; } flag =3D virQEMUCapsTypeFromString(str); if (flag < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown qemu capabilities flag %s"), str); - goto cleanup; + return -1; } VIR_FREE(str); virQEMUCapsSet(qemuCaps, flag); @@ -4224,20 +4222,20 @@ virQEMUCapsLoadCache(virArch hostArch, if (virXPathUInt("string(./version)", ctxt, &qemuCaps->version) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing version in QEMU capabilities cache")); - goto cleanup; + return -1; } =20 if (virXPathUInt("string(./kvmVersion)", ctxt, &qemuCaps->kvmVersion) = < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing version in QEMU capabilities cache")); - goto cleanup; + return -1; } =20 if (virXPathUInt("string(./microcodeVersion)", ctxt, &qemuCaps->microcodeVersion) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing microcode version in QEMU capabilities c= ache")); - goto cleanup; + return -1; } =20 qemuCaps->hostCPUSignature =3D virXPathString("string(./hostCPUSignatu= re)", ctxt); @@ -4251,35 +4249,35 @@ virQEMUCapsLoadCache(virArch hostArch, if (virXPathBoolean("boolean(./kernelVersion)", ctxt) > 0) { qemuCaps->kernelVersion =3D virXPathString("string(./kernelVersion= )", ctxt); if (!qemuCaps->kernelVersion) - goto cleanup; + return -1; } =20 if (!(str =3D virXPathString("string(./arch)", ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing arch in QEMU capabilities cache")); - goto cleanup; + return -1; } if (!(qemuCaps->arch =3D virArchFromString(str))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unknown arch %s in QEMU capabilities cache"), st= r); - goto cleanup; + return -1; } VIR_FREE(str); =20 if (virXPathBoolean("boolean(./cpudata)", ctxt) > 0) { qemuCaps->cpuData =3D virCPUDataParseNode(virXPathNode("./cpudata"= , ctxt)); if (!qemuCaps->cpuData) - goto cleanup; + return -1; } =20 if (virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_KVM) < 0 || virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_QEMU) < 0) - goto cleanup; + return -1; =20 if ((n =3D virXPathNodeSet("./gic", ctxt, &nodes)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("failed to parse qemu capabilities gic")); - goto cleanup; + return -1; } if (n > 0) { unsigned int uintValue; @@ -4295,13 +4293,13 @@ virQEMUCapsLoadCache(virArch hostArch, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing GIC version " "in QEMU capabilities cache")); - goto cleanup; + return -1; } if (virStrToLong_ui(str, NULL, 10, &uintValue) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed GIC version " "in QEMU capabilities cache")); - goto cleanup; + return -1; } cap->version =3D uintValue; VIR_FREE(str); @@ -4310,13 +4308,13 @@ virQEMUCapsLoadCache(virArch hostArch, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing in-kernel GIC information " "in QEMU capabilities cache")); - goto cleanup; + return -1; } if (!(boolValue =3D STREQ(str, "yes")) && STRNEQ(str, "no")) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed in-kernel GIC information " "in QEMU capabilities cache")); - goto cleanup; + return -1; } if (boolValue) cap->implementation |=3D VIR_GIC_IMPLEMENTATION_KERNEL; @@ -4326,13 +4324,13 @@ virQEMUCapsLoadCache(virArch hostArch, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing emulated GIC information " "in QEMU capabilities cache")); - goto cleanup; + return -1; } if (!(boolValue =3D STREQ(str, "yes")) && STRNEQ(str, "no")) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed emulated GIC information " "in QEMU capabilities cache")); - goto cleanup; + return -1; } if (boolValue) cap->implementation |=3D VIR_GIC_IMPLEMENTATION_EMULATED; @@ -4342,7 +4340,7 @@ virQEMUCapsLoadCache(virArch hostArch, VIR_FREE(nodes); =20 if (virQEMUCapsParseSEVInfo(qemuCaps, ctxt) < 0) - goto cleanup; + return -1; =20 virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_KVM); virQEMUCapsInitHostCPUModel(qemuCaps, hostArch, VIR_DOMAIN_VIRT_QEMU); @@ -4356,11 +4354,7 @@ virQEMUCapsLoadCache(virArch hostArch, if (skipInvalidation) qemuCaps->invalidation =3D false; =20 - ret =3D 0; - cleanup: - VIR_FREE(str); - VIR_FREE(nodes); - return ret; + return 0; } =20 =20 --=20 2.31.1 From nobody Fri Mar 29 12:34:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1637244141147475.342316568339; Thu, 18 Nov 2021 06:02:21 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-479-mj79Xc34NAmy77hOb9J4ew-1; Thu, 18 Nov 2021 09:02:16 -0500 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 1ECFE804142; Thu, 18 Nov 2021 14:02:10 +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 E0E495F4F4; Thu, 18 Nov 2021 14:02:09 +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 2A8311800FE4; Thu, 18 Nov 2021 14:02:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIE05k8010901 for ; Thu, 18 Nov 2021 09:00:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id EE7AD4047279; Thu, 18 Nov 2021 14:00:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EAD41404727A for ; Thu, 18 Nov 2021 14:00:04 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D2AC0185A7BA for ; Thu, 18 Nov 2021 14:00:04 +0000 (UTC) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-542-y-EStvYvOliXGgYranrJgw-1; Thu, 18 Nov 2021 09:00:02 -0500 Received: by mail-qk1-f182.google.com with SMTP id t83so6345355qke.8 for ; Thu, 18 Nov 2021 06:00:02 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id e7sm1542168qtx.72.2021.11.18.06.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:00:02 -0800 (PST) X-MC-Unique: mj79Xc34NAmy77hOb9J4ew-1 X-MC-Unique: y-EStvYvOliXGgYranrJgw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EMbpwKXPT8lppPkIBDMnSQQ/2gjYRbVCueAiT1H2JSY=; b=3oFX0rUPkECahqzMYU281S36eRkEihVoS8Ih6mzQ4Q2L4QUWRtjtgPSVmeKVAbbbdk pnKLEtfx7N2ULHqkpO9JSjA7YeIgjKLQcJfPfN5UHHwLT4Vt+TvBRv+BBkSk1zQZP+BY mjaDbk8G7gxsHfyiNv8hGtSttDAM6aCaZBLrpDy6Qw7PGAXTiX5SKvo84nLmYFW5JP9W hzlQSeaI7802kevylPQ+Amnpg2FAs1NcNmFoe5PQanQJTkNxbJrXl5fpycEpQJc3amVm 1XaGxu+Rie0ty6KtPXKtJUQRqfLOesR/7HPHM46w5HmeMFmAalBMWKFIQ/Rb+H2z90a9 JSMw== X-Gm-Message-State: AOAM531aIun8nRtH3ML29dmSoNoOLnvgkq1TFTJ45XBFW30q9ZeVwdh2 6R7+sSDPzz7R8Hy1FkP3YzJlgfjaWeGMLw== X-Google-Smtp-Source: ABdhPJxktLLdGrtox55Swk/ldpWbd5/BLt/KRrr3b113cbhhfAVFfuI9ZKKOnTnVVKLIetIKFBPqWA== X-Received: by 2002:a05:620a:113b:: with SMTP id p27mr21211201qkk.33.1637244002209; Thu, 18 Nov 2021 06:00:02 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 2/7] cpu_x86.c: remove 'guest' param from x86Compute() Date: Thu, 18 Nov 2021 10:59:39 -0300 Message-Id: <20211118135944.272979-3-danielhb413@gmail.com> In-Reply-To: <20211118135944.272979-1-danielhb413@gmail.com> References: <20211118135944.272979-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-loop: libvir-list@redhat.com Cc: danielh413@gmail.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 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-ZM-MESSAGEID: 1637244182360100001 Content-Type: text/plain; charset="utf-8" x86Compute() is a static function called only by virCPUx86Compare() which passes NULL to the 'guest' parameter of x86Compute(). The last caller of x86Compute() that used it with 'guest' !=3D NULL was an API called 'cpuGuestData'. This API was dropped by commit 03fa904c0c0cb2 a few years ago. Since then all callers of x86Compute() uses it with 'guest' =3D NULL. Removing the 'guest' parameter allow us to remove a good chunk of logic that isn't being used for awhile. Signed-off-by: Daniel Henrique Barboza --- src/cpu/cpu_x86.c | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 54cfed3fe6..e396bbb4e4 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1833,7 +1833,6 @@ virCPUx86DataParse(xmlNodePtr node) static virCPUCompareResult x86Compute(virCPUDef *host, virCPUDef *cpu, - virCPUData **guest, char **message) { virCPUx86Map *map =3D NULL; @@ -1848,7 +1847,6 @@ x86Compute(virCPUDef *host, g_autoptr(virCPUData) guestData =3D NULL; virCPUCompareResult ret; virCPUx86CompareResult result; - virArch arch; size_t i; =20 if (cpu->arch !=3D VIR_ARCH_NONE) { @@ -1870,9 +1868,6 @@ x86Compute(virCPUDef *host, } return VIR_CPU_COMPARE_INCOMPATIBLE; } - arch =3D cpu->arch; - } else { - arch =3D host->arch; } =20 if (cpu->vendor && @@ -1939,37 +1934,6 @@ x86Compute(virCPUDef *host, return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 - if (guest) { - guest_model =3D x86ModelCopy(host_model); - - if (cpu->vendor && host_model->vendor && - virCPUx86DataAddItem(&guest_model->data, - &host_model->vendor->data) < 0) - return VIR_CPU_COMPARE_ERROR; - - if (host_model->signatures && host_model->signatures->count > 0) { - virCPUx86Signature *sig =3D &host_model->signatures->items[0]; - if (x86DataAddSignature(&guest_model->data, - virCPUx86SignatureToCPUID(sig)) < 0) - return VIR_CPU_COMPARE_ERROR; - } - - if (cpu->type =3D=3D VIR_CPU_TYPE_GUEST - && cpu->match =3D=3D VIR_CPU_MATCH_EXACT) - x86DataSubtract(&guest_model->data, &diff->data); - - if (x86DataAdd(&guest_model->data, &cpu_force->data)) - return VIR_CPU_COMPARE_ERROR; - - x86DataSubtract(&guest_model->data, &cpu_disable->data); - - if (!(guestData =3D virCPUDataNew(arch))) - return VIR_CPU_COMPARE_ERROR; - x86DataCopy(&guestData->data.x86, &guest_model->data); - - *guest =3D g_steal_pointer(&guestData); - } - return ret; } #undef virX86CpuIncompatible @@ -1994,7 +1958,7 @@ virCPUx86Compare(virCPUDef *host, return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 - ret =3D x86Compute(host, cpu, NULL, &message); + ret =3D x86Compute(host, cpu, &message); =20 if (ret =3D=3D VIR_CPU_COMPARE_INCOMPATIBLE && failIncompatible) { if (message) --=20 2.31.1 From nobody Fri Mar 29 12:34:06 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 1637244098543793.4289061258443; Thu, 18 Nov 2021 06:01:38 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-511-x54K4QM2M0eRNJZWQvJnkg-1; Thu, 18 Nov 2021 09:01:34 -0500 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 85B818799EC; Thu, 18 Nov 2021 14:01:19 +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 EC0B160BF1; Thu, 18 Nov 2021 14:01:16 +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 D217F4A703; Thu, 18 Nov 2021 14:01:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIE06VV010911 for ; Thu, 18 Nov 2021 09:00:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 005FE2144B23; Thu, 18 Nov 2021 14:00:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EDDD92144B22 for ; Thu, 18 Nov 2021 14:00:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CF3A0811E78 for ; Thu, 18 Nov 2021 14:00:05 +0000 (UTC) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-515-sabADQ0qON2WxLPi3y5eEw-1; Thu, 18 Nov 2021 09:00:04 -0500 Received: by mail-qv1-f51.google.com with SMTP id bu11so4662147qvb.0 for ; Thu, 18 Nov 2021 06:00:03 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id e7sm1542168qtx.72.2021.11.18.06.00.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:00:03 -0800 (PST) X-MC-Unique: x54K4QM2M0eRNJZWQvJnkg-1 X-MC-Unique: sabADQ0qON2WxLPi3y5eEw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=woR61WsW5lGCKmzSZN+jzH6G382my6ZXoqT+N6I9MxE=; b=6MzAGQD4wAlIjY+pMfXRcTgzpL6bFzkTKkd/r8l8SdM83/Qzo5ZdxET8o4DOJLhs9v LpZTSRlRl1TrrxU8u6MEbqurygQQfVQtq1OHiiDcx0PNxnJVox3dDW9qfVZbElqMlVXf kCuNJYYNrMoPUTe37PvfaE+SUFD8volfwOQBtuNCSs/WnUuy7p9CzREm/yFMEjoJbAGs Z9/C5cZTrIyZr1tyVLkXs+MjlR0RKMED2N6ohmRyzpRI3fL23UUoLtGTJ2wSXVR4vB+F DG3/NABaVpve/gJZQcpeGNFsmsEdovrLxT3J0zO6qtNPskEMmpIiIsHgO5B8oFrbRl8k P3aQ== X-Gm-Message-State: AOAM533dmK52gMzc1y7tN1Q+4HgyKOAfW7YnXM+pY1zX4cd0LNI+AUyP SDJucnnDf8pfx1jBCWeP7lxjXMZ52fZHgA== X-Google-Smtp-Source: ABdhPJxwk2jmf0RN/km2/8R9B7x8QlJokZoB9HFIwcUW7ETUxr5LDDnwS08SrbmZHlbY1G88775YvA== X-Received: by 2002:ad4:5747:: with SMTP id q7mr64393993qvx.19.1637244003526; Thu, 18 Nov 2021 06:00:03 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 3/7] cpu_ppc64.c: remove 'guest' param from ppc64Compute() Date: Thu, 18 Nov 2021 10:59:40 -0300 Message-Id: <20211118135944.272979-4-danielhb413@gmail.com> In-Reply-To: <20211118135944.272979-1-danielhb413@gmail.com> References: <20211118135944.272979-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: danielh413@gmail.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 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-ZM-MESSAGEID: 1637244132903100001 Content-Type: text/plain; charset="utf-8" ppc64Compute() is used only once, by virCPUppc64Compare(), which doesn't use the 'guest' parameter. The reason is similar to what was mentioned in the previous patch: this parameter was being used by an API called 'cpuGuestData' that was dropped by commit 03fa904c0c0cb2. Removing the 'guest' parameter will not only remove unused code from ppc64Compute() but also remove the ppc64MakeCPUData() entirely. Signed-off-by: Daniel Henrique Barboza --- src/cpu/cpu_ppc64.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index c7caaa9608..314d2f7c86 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -379,32 +379,15 @@ ppc64LoadMap(void) return g_steal_pointer(&map); } =20 -static virCPUData * -ppc64MakeCPUData(virArch arch, - virCPUppc64Data *data) -{ - g_autoptr(virCPUData) cpuData =3D NULL; - - cpuData =3D g_new0(virCPUData, 1); - cpuData->arch =3D arch; - - if (ppc64DataCopy(&cpuData->data.ppc64, data) < 0) - return NULL; - - return g_steal_pointer(&cpuData); -} - static virCPUCompareResult ppc64Compute(virCPUDef *host, const virCPUDef *other, - virCPUData **guestData, char **message) { g_autoptr(virCPUppc64Map) map =3D NULL; g_autoptr(virCPUppc64Model) host_model =3D NULL; g_autoptr(virCPUppc64Model) guest_model =3D NULL; g_autoptr(virCPUDef) cpu =3D NULL; - virArch arch; size_t i; =20 /* Ensure existing configurations are handled correctly */ @@ -431,9 +414,6 @@ ppc64Compute(virCPUDef *host, =20 return VIR_CPU_COMPARE_INCOMPATIBLE; } - arch =3D cpu->arch; - } else { - arch =3D host->arch; } =20 if (cpu->vendor && @@ -506,10 +486,6 @@ ppc64Compute(virCPUDef *host, return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 - if (guestData) - if (!(*guestData =3D ppc64MakeCPUData(arch, &guest_model->data))) - return VIR_CPU_COMPARE_ERROR; - return VIR_CPU_COMPARE_IDENTICAL; } =20 @@ -532,7 +508,7 @@ virCPUppc64Compare(virCPUDef *host, return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 - ret =3D ppc64Compute(host, cpu, NULL, &message); + ret =3D ppc64Compute(host, cpu, &message); =20 if (failIncompatible && ret =3D=3D VIR_CPU_COMPARE_INCOMPATIBLE) { ret =3D VIR_CPU_COMPARE_ERROR; --=20 2.31.1 From nobody Fri Mar 29 12:34:06 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 163724415590456.88448961785207; Thu, 18 Nov 2021 06:02:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-466-Kd5OqYPbNsm4_4lweQvCmA-1; Thu, 18 Nov 2021 09:02:32 -0500 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 2175819253CD; Thu, 18 Nov 2021 14:02:24 +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 E9BBE56AB3; Thu, 18 Nov 2021 14:02:23 +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 AF1A54E58E; Thu, 18 Nov 2021 14:02:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIE0Co6010939 for ; Thu, 18 Nov 2021 09:00:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5568F404727D; Thu, 18 Nov 2021 14:00:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 507654047279 for ; Thu, 18 Nov 2021 14:00:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 367F785A5A8 for ; Thu, 18 Nov 2021 14:00:07 +0000 (UTC) Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-505-NmHZvgoEP8mbLCF2yio05w-1; Thu, 18 Nov 2021 09:00:05 -0500 Received: by mail-qv1-f46.google.com with SMTP id g1so4620012qvd.2 for ; Thu, 18 Nov 2021 06:00:05 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id e7sm1542168qtx.72.2021.11.18.06.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:00:04 -0800 (PST) X-MC-Unique: Kd5OqYPbNsm4_4lweQvCmA-1 X-MC-Unique: NmHZvgoEP8mbLCF2yio05w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iGtHPqdj+RlERq5meqmWN1WMBt+PuAaIxcqih6T8dKs=; b=TCslwsCSBytYisXsdlxSpOHcsht4PVNWp1SnVnD6DgnkfChk1TBEMJorYW4IeDdVnf DY5725WiZFpEuCXlOazrQPurIqVsFnlWyzDmd86NmGcYWohjp4OSknhY5mnc+hLt45PX RKzVhqKFNoqUzxVrTviAfEuSPEGup32OEnj/cdq4BwFEiCMqQxT0VNEWHKGqo1jL05YN zWa7XABlNv/R0eXgY3fumCddvGCa5sZxXeG28tcubNQMvSqbzTwwIDF1ybsDtuEG7326 +a8OKPS4ph09xgRcIYGYppGpKJH7zJTOq8L3kjxA+ufKSbXhmhSo+23r3wx5C/QjxYXA JYXQ== X-Gm-Message-State: AOAM530n/ZkfFJv1q4Iv3ZeA5aQGF2K664AThYBZXRcoDBmHaJvc0LlB BU6kgALc1PxY2cUSjoAzU3AeAMQ+yADLMA== X-Google-Smtp-Source: ABdhPJxdQVeA87PTe0pOaXAHr3/CHRhXyCnIZ2wWLJZ+9F51QMUIcUzEFlrptnPKsaOsXefX57eoDw== X-Received: by 2002:ad4:5be4:: with SMTP id k4mr63891852qvc.20.1637244004897; Thu, 18 Nov 2021 06:00:04 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 4/7] qemu_capabilities.c: use g_autofree in virQEMUCapsLoadHostCPUModelInfo Date: Thu, 18 Nov 2021 10:59:41 -0300 Message-Id: <20211118135944.272979-5-danielhb413@gmail.com> In-Reply-To: <20211118135944.272979-1-danielhb413@gmail.com> References: <20211118135944.272979-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-loop: libvir-list@redhat.com Cc: danielh413@gmail.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 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-ZM-MESSAGEID: 1637244199469100001 Content-Type: text/plain; charset="utf-8" Use 'g_autofree' in the 'str' parameter and remove the 'cleanup' label. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index aef76ecc56..5257fe64b2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3723,21 +3723,18 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *c= aps, xmlXPathContextPtr ctxt, const char *typeStr) { - char *str =3D NULL; + g_autofree char *str =3D NULL; xmlNodePtr hostCPUNode; g_autofree xmlNodePtr *nodes =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autoptr(qemuMonitorCPUModelInfo) hostCPU =3D NULL; g_autofree char *xpath =3D g_strdup_printf("./hostCPU[@type=3D'%s']", = typeStr); - int ret =3D -1; size_t i; int n; int val; =20 - if (!(hostCPUNode =3D virXPathNode(xpath, ctxt))) { - ret =3D 0; - goto cleanup; - } + if (!(hostCPUNode =3D virXPathNode(xpath, ctxt))) + return 0; =20 hostCPU =3D g_new0(qemuMonitorCPUModelInfo, 1); =20 @@ -3745,14 +3742,14 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *c= aps, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing host CPU model name in QEMU " "capabilities cache")); - goto cleanup; + return -1; } =20 if (!(str =3D virXMLPropString(hostCPUNode, "migratability")) || (val =3D virTristateBoolTypeFromString(str)) <=3D 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("invalid migratability value for host CPU model")= ); - goto cleanup; + return -1; } hostCPU->migratability =3D val =3D=3D VIR_TRISTATE_BOOL_YES; VIR_FREE(str); @@ -3772,7 +3769,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing 'name' attribute for a host CPU" " model property in QEMU capabilities cac= he")); - goto cleanup; + return -1; } =20 if (!(str =3D virXMLPropString(ctxt->node, "type")) || @@ -3780,7 +3777,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing or invalid CPU model property ty= pe " "in QEMU capabilities cache")); - goto cleanup; + return -1; } VIR_FREE(str); =20 @@ -3798,7 +3795,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, _("invalid string value for '%s' host C= PU " "model property in QEMU capabilities = cache"), prop->name); - goto cleanup; + return -1; } break; =20 @@ -3809,7 +3806,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, _("invalid number value for '%s' host C= PU " "model property in QEMU capabilities = cache"), prop->name); - goto cleanup; + return -1; } break; =20 @@ -3823,7 +3820,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *cap= s, _("unknown migratable value for '%s' ho= st " "CPU model property"), prop->name); - goto cleanup; + return -1; } =20 prop->migratable =3D val; @@ -3833,11 +3830,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *ca= ps, } =20 caps->hostCPU.info =3D g_steal_pointer(&hostCPU); - ret =3D 0; - - cleanup: - VIR_FREE(str); - return ret; + return 0; } =20 =20 --=20 2.31.1 From nobody Fri Mar 29 12:34:06 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 1637244156905759.0676211583198; Thu, 18 Nov 2021 06:02:36 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-486-8KmRKwPONh6E8tSxJvIY8g-1; Thu, 18 Nov 2021 09:02:33 -0500 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 A9F5B19253C6; Thu, 18 Nov 2021 14:02:25 +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 8D7465BAE0; Thu, 18 Nov 2021 14:02:25 +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 5748C4EA29; Thu, 18 Nov 2021 14:02:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIE08L1010927 for ; Thu, 18 Nov 2021 09:00:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id C1174404727A; Thu, 18 Nov 2021 14:00:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD895404727D for ; Thu, 18 Nov 2021 14:00:08 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A6EF110726A2 for ; Thu, 18 Nov 2021 14:00:08 +0000 (UTC) Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-514-2Vd8JDouNOK0VSTrtYj4rQ-1; Thu, 18 Nov 2021 09:00:06 -0500 Received: by mail-qv1-f52.google.com with SMTP id b17so4595685qvl.9 for ; Thu, 18 Nov 2021 06:00:06 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id e7sm1542168qtx.72.2021.11.18.06.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:00:06 -0800 (PST) X-MC-Unique: 8KmRKwPONh6E8tSxJvIY8g-1 X-MC-Unique: 2Vd8JDouNOK0VSTrtYj4rQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PWbpPn56PHYTRGFbYqMOSf2cICZeAmmqxLYU6fuNZR8=; b=eFDxX4BvGX7UM+pPNDtb3srPB2KrGGDXiBU+YnnDrKDt9kkeF+HsdtoeBBy4fR4h18 1vN2fX0Iy+pvX/ovSPIGEcfqAY8IJ4mPfCEpTTnP3HTKSVbXP6uk1ALUTVFy1QY29TD9 ojYOJ3AdV69aNQRO1YBpXAvv3AVJK/sHYEe8b7/fhMoyTxwrt1gQ1i2uETFgTDWybhvl oErXcLDbLkeaPnnYgJAfTtMJfjYVl7norU5DhbxbUlRqS+Q6lm9un9ekzg2QEzP/7BIY Mo6kUmTcxZKFK2pE54iG0+X6S8VMQVS42t/9gYigFxsm9zzUDYkUfD+M/eCKyNbd/EBQ hldA== X-Gm-Message-State: AOAM532BDP6NCw6gfQYkTKywTPAuV+8OE3GV9745fjA4yKyGco7okAkA zvXaWOzdd9hVe7+7UqoR7Xpk/mhS+HXmnA== X-Google-Smtp-Source: ABdhPJx4fLTdmoAj+AVUJq6qaLvZ6YR77STolR/2uyqEDUie7hzlhEV8bDkw9dJJqiZzpRmfIwb4+w== X-Received: by 2002:a05:6214:300b:: with SMTP id ke11mr64629137qvb.42.1637244006387; Thu, 18 Nov 2021 06:00:06 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 5/7] domain_conf.h: add autoptr cleanup func to virDomainXMLOptionPtr Date: Thu, 18 Nov 2021 10:59:42 -0300 Message-Id: <20211118135944.272979-6-danielhb413@gmail.com> In-Reply-To: <20211118135944.272979-1-danielhb413@gmail.com> References: <20211118135944.272979-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-loop: libvir-list@redhat.com Cc: danielh413@gmail.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.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-ZM-MESSAGEID: 1637244200316100003 Content-Type: text/plain; charset="utf-8" This will enable code cleanups on code that still relies on virObjectUnref() this pointer manually. Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_conf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ab9a7d66f8..0ecd3803db 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3214,6 +3214,7 @@ struct _virDomainXMLOption { /* Snapshot postparse callbacks */ virDomainMomentPostParseCallback momentPostParse; }; +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainXMLOption, virObjectUnref); =20 struct virDomainDefPostParseDeviceIteratorData { virDomainXMLOption *xmlopt; --=20 2.31.1 From nobody Fri Mar 29 12:34:06 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 1637244162809807.355469628074; Thu, 18 Nov 2021 06:02:42 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-560-uCC4UH54MQ20Nx-B-cKnnA-1; Thu, 18 Nov 2021 09:02:39 -0500 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 9FE9719253C8; Thu, 18 Nov 2021 14:02: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 80D6260C4A; Thu, 18 Nov 2021 14:02:28 +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 4D77B4EA38; Thu, 18 Nov 2021 14:02:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIE0AOW010932 for ; Thu, 18 Nov 2021 09:00:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8B7232144B23; Thu, 18 Nov 2021 14:00:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 85AE02144B22 for ; Thu, 18 Nov 2021 14:00:10 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68CA180A0AC for ; Thu, 18 Nov 2021 14:00:10 +0000 (UTC) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-113-k3sCpwj9OKO_-Hyn1TrT0g-1; Thu, 18 Nov 2021 09:00:08 -0500 Received: by mail-qt1-f170.google.com with SMTP id j17so6089094qtx.2 for ; Thu, 18 Nov 2021 06:00:08 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id e7sm1542168qtx.72.2021.11.18.06.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:00:07 -0800 (PST) X-MC-Unique: uCC4UH54MQ20Nx-B-cKnnA-1 X-MC-Unique: k3sCpwj9OKO_-Hyn1TrT0g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mn1iMJkdZnz921TVVcPwix9TlPbpCcBIUEOzg7xwzPY=; b=OcA8/f5x29m7rcvqX+QH8SMEAcb+DVEDPok86i/BowLVVmXrECf6o0+iijx/l8/ZmQ RXuOk1CBBeiaVOHL/K+4e/KTwNSMlt0+zA3acW8oI4oVFqn7kYIPpTEpmOiYfiCln8X/ ghoXLM394DFwSu6yBKN7rXz8LrlN+YzgYVQTxC31WpagKbjbBsX+ACXrJRg5N40nDLDG HHXTNP9PWyZ7UPDE0oIFnYfPHz8NOJUuVIJJW4WdTxZs7Qrb5VLm6XvJsIxQriGaqapb +wFbppnmbfNMPHHTWfccT6JZUa90McYp8ThP40RiNO4tLOFWe6x7gGQI/isHUdAGsJji 7XkA== X-Gm-Message-State: AOAM533UYEqeKm8MFLB3onqX/U6X5q4uQp34QFUbKiGwy8fQldz9COx5 ULLXvDqb+t1qIrJgzoQjbqyywCNR906Svg== X-Google-Smtp-Source: ABdhPJxvSKf8nO1Z83OQGe8M8Y418AdRMAh9nkWxNA93JrXlgp3qLTwlQK0LWbjUnUxCCCWcuBG0wg== X-Received: by 2002:ac8:5cc5:: with SMTP id s5mr26783256qta.97.1637244007980; Thu, 18 Nov 2021 06:00:07 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 6/7] qemu_process.c: use g_autoptr() in qemuProcessQMPInitMonitor Date: Thu, 18 Nov 2021 10:59:43 -0300 Message-Id: <20211118135944.272979-7-danielhb413@gmail.com> In-Reply-To: <20211118135944.272979-1-danielhb413@gmail.com> References: <20211118135944.272979-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: danielh413@gmail.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 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-ZM-MESSAGEID: 1637244207730100003 Content-Type: text/plain; charset="utf-8" The 'xmlopt' parameter can be auto-unref by using g_autoptr(). Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b6c81dd23a..c355a39e15 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -9257,9 +9257,8 @@ qemuProcessQMPInitMonitor(qemuMonitor *mon) static int qemuProcessQMPConnectMonitor(qemuProcessQMP *proc) { - virDomainXMLOption *xmlopt =3D NULL; + g_autoptr(virDomainXMLOption) xmlopt =3D NULL; virDomainChrSourceDef monConfig; - int ret =3D -1; =20 VIR_DEBUG("proc=3D%p, emulator=3D%s, proc->pid=3D%lld", proc, proc->binary, (long long)proc->pid); @@ -9271,25 +9270,21 @@ qemuProcessQMPConnectMonitor(qemuProcessQMP *proc) if (!(xmlopt =3D virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL)) = || !(proc->vm =3D virDomainObjNew(xmlopt)) || !(proc->vm->def =3D virDomainDefNew(xmlopt))) - goto cleanup; + return -1; =20 proc->vm->pid =3D proc->pid; =20 if (!(proc->mon =3D qemuMonitorOpen(proc->vm, &monConfig, true, 0, virEventThreadGetContext(proc->event= Thread), &callbacks, NULL))) - goto cleanup; + return -1; =20 virObjectLock(proc->mon); =20 if (qemuProcessQMPInitMonitor(proc->mon) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - virObjectUnref(xmlopt); - return ret; + return 0; } =20 =20 --=20 2.31.1 From nobody Fri Mar 29 12:34:06 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 1637244164947153.52433964766408; Thu, 18 Nov 2021 06:02:44 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-204-2x9diWS9MSaQ5gblAKZF0Q-1; Thu, 18 Nov 2021 09:02:39 -0500 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 194C919253CF; Thu, 18 Nov 2021 14:02:32 +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 C9D4710016F2; Thu, 18 Nov 2021 14:02:31 +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 76E4E4EA3C; Thu, 18 Nov 2021 14:02:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIE0Cx6010943 for ; Thu, 18 Nov 2021 09:00:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9319C404727E; Thu, 18 Nov 2021 14:00:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8ED084047279 for ; Thu, 18 Nov 2021 14:00:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7827385A5BD for ; Thu, 18 Nov 2021 14:00:12 +0000 (UTC) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-248-0YhKd1nrNI2zeylORRrYeQ-1; Thu, 18 Nov 2021 09:00:10 -0500 Received: by mail-qt1-f179.google.com with SMTP id a2so6039670qtx.11 for ; Thu, 18 Nov 2021 06:00:10 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id e7sm1542168qtx.72.2021.11.18.06.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:00:09 -0800 (PST) X-MC-Unique: 2x9diWS9MSaQ5gblAKZF0Q-1 X-MC-Unique: 0YhKd1nrNI2zeylORRrYeQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0SWwMv3itC9hqOJzfgS9rFvBfPcN7YpP/MFJxbNZzts=; b=oMKa8qMuADuWs+gVWDsEmXsyUDxW+jcRWLNElI3jSW1q6RymDX+gWL4/LnNcnCk1l3 5SHjaH3p1oQ7Xqeq/aFDkDIixwAbqr5pLYHctMSt5ZclzxBFzv3Q4vLVmSrTjHpewvIS 6htyry2YwJdpYsTyGV/wfekABezyl+rTvWWiF5G0OUrWKTERf8D7iRwWfQYYkzp7p/gt IJkrzBeNKfqzX9Ccp1cPaBUgAQOoLJ9N+wZSm3JTb/ObqEKQqJQYkF6tdux+4pfeIsCg hn03VieMqGl463h3ufwpp3Iao0/MH1hsEbuscqSMJXyaY/Udaqojkp4hLCKYuQAQ8hNX Kl0w== X-Gm-Message-State: AOAM533c25N03YQ5lHmiyeQ9yHjAL8BdUkOHndYYXQ+KF5zrvbClxuSL CWNlpKTYgyrJawfzDf2UekuI8axnFPcPdg== X-Google-Smtp-Source: ABdhPJx6oIIgd564SgAyskoxWruz3UWQqe0jZTyZqa73Q0lUXAg0QfiqMpWQmd+NMzi22NDZta5ETw== X-Received: by 2002:ac8:5a8e:: with SMTP id c14mr26584500qtc.332.1637244009262; Thu, 18 Nov 2021 06:00:09 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 7/7] qemu_capabilities.c: use g_autoptr() in virQEMUCapsInitHostCPUModel() Date: Thu, 18 Nov 2021 10:59:44 -0300 Message-Id: <20211118135944.272979-8-danielhb413@gmail.com> In-Reply-To: <20211118135944.272979-1-danielhb413@gmail.com> References: <20211118135944.272979-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-loop: libvir-list@redhat.com Cc: danielh413@gmail.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.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-ZM-MESSAGEID: 1637244209486100005 Content-Type: text/plain; charset="utf-8" All 'virCPUDef' pointers can be auto-freed and the 'cleanup' label removed. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5257fe64b2..dbf08d681b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3597,11 +3597,11 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, virArch hostArch, virDomainVirtType type) { - virCPUDef *cpu =3D NULL; - virCPUDef *cpuExpanded =3D NULL; - virCPUDef *migCPU =3D NULL; - virCPUDef *hostCPU =3D NULL; - virCPUDef *fullCPU =3D NULL; + g_autoptr(virCPUDef) cpu =3D NULL; + g_autoptr(virCPUDef) cpuExpanded =3D NULL; + g_autoptr(virCPUDef) migCPU =3D NULL; + g_autoptr(virCPUDef) hostCPU =3D NULL; + g_autoptr(virCPUDef) fullCPU =3D NULL; size_t i; int rc; =20 @@ -3676,19 +3676,14 @@ virQEMUCapsInitHostCPUModel(virQEMUCaps *qemuCaps, goto error; } =20 - virQEMUCapsSetHostModel(qemuCaps, type, cpu, migCPU, fullCPU); + virQEMUCapsSetHostModel(qemuCaps, type, g_steal_pointer(&cpu), + g_steal_pointer(&migCPU), + g_steal_pointer(&fullCPU)); =20 - cleanup: - virCPUDefFree(cpuExpanded); - virCPUDefFree(hostCPU); return; =20 error: - virCPUDefFree(cpu); - virCPUDefFree(migCPU); - virCPUDefFree(fullCPU); virResetLastError(); - goto cleanup; } =20 =20 --=20 2.31.1