From nobody Thu Mar 28 19:11:11 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 1637245249310810.2301685496395; Thu, 18 Nov 2021 06:20:49 -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-400-bcdF6HDYPliZo3AMyanl8g-1; Thu, 18 Nov 2021 09:20:47 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23DDF10151E2; Thu, 18 Nov 2021 14:20: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 CCFE860657; Thu, 18 Nov 2021 14:20:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 752B74A703; Thu, 18 Nov 2021 14:20:41 +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 1AIEKenH012961 for ; Thu, 18 Nov 2021 09:20:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3E995404727D; Thu, 18 Nov 2021 14:20:40 +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 3A5E5404727F for ; Thu, 18 Nov 2021 14:20:40 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 1BE6F85A5BD for ; Thu, 18 Nov 2021 14:20:40 +0000 (UTC) Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-177-dRT25IuJPvmR9EruZEusrA-1; Thu, 18 Nov 2021 09:20:38 -0500 Received: by mail-ua1-f44.google.com with SMTP id i6so13994203uae.6 for ; Thu, 18 Nov 2021 06:20:38 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id b8sm1734306vsl.19.2021.11.18.06.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:37 -0800 (PST) X-MC-Unique: bcdF6HDYPliZo3AMyanl8g-1 X-MC-Unique: dRT25IuJPvmR9EruZEusrA-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=QpQgwarAwV8KxlI5TOljPmtc5epryLqpIZ26LMO26PC1LtKGGZvpgbILumEHU9cqD1 6OSzdJRGiYj22sbdiayQ/GlThToszD64nmGk+/0pSjtB5hKgRgPTeRlhKSc3yAbTlMmv ofWkGjZRvEmCIR8SOd6G7kwlw2k5IrWgbq5F4o+vSqPM//VORJVYZS/uj5Icy1l2bIYx y/PJ3/VUn7FX4h8xdDI9SeLp6+U774H5vp/0HNbxSUHHkKXX10j+8XVpEXgUmnfccMns njGTex+NobV1PMHfKKI4+FMpywkGkJ05hUT2v/N8yEcVswcqMSsUAGmDeOnVB80+EJkW 5SJw== X-Gm-Message-State: AOAM5327pem5CKgRqIHeH8BzhRhlojBpfhvnxe9PhPZWqjR91e9RmLum +eyjCzNxxxuBlWzE7tYQEW536K01DcUcJg== X-Google-Smtp-Source: ABdhPJx/l6St0xMM9BKy0q4RPTgaSO8G3AX6KO5IBDIUU2oRf8HI5r0yPv+YCaAI1gjgHiY/zQ6Tbg== X-Received: by 2002:a67:af0a:: with SMTP id v10mr82115564vsl.35.1637245237986; Thu, 18 Nov 2021 06:20:37 -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 11:20:18 -0300 Message-Id: <20211118142024.275704-2-danielhb413@gmail.com> In-Reply-To: <20211118142024.275704-1-danielhb413@gmail.com> References: <20211118142024.275704-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: danielhb413@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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1637245250084100001 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 Thu Mar 28 19:11:11 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 1637245259874125.7010841278319; Thu, 18 Nov 2021 06:20:59 -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-500-m81Q-YrcP6ahjZxZQq-sRw-1; Thu, 18 Nov 2021 09:20:54 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1F56F804163; Thu, 18 Nov 2021 14:20:46 +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 02EDD179B3; Thu, 18 Nov 2021 14:20:46 +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 C9FB74E9E2; Thu, 18 Nov 2021 14:20:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIEKfGU012969 for ; Thu, 18 Nov 2021 09:20:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4139940CFD10; Thu, 18 Nov 2021 14:20:41 +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 3B97F40CFD11 for ; Thu, 18 Nov 2021 14:20:41 +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 203CB1066682 for ; Thu, 18 Nov 2021 14:20:41 +0000 (UTC) Received: from mail-ua1-f48.google.com (mail-ua1-f48.google.com [209.85.222.48]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-gQST1-RrM16mUca9N-UWvQ-1; Thu, 18 Nov 2021 09:20:39 -0500 Received: by mail-ua1-f48.google.com with SMTP id j14so4191684uan.10 for ; Thu, 18 Nov 2021 06:20:39 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id b8sm1734306vsl.19.2021.11.18.06.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:39 -0800 (PST) X-MC-Unique: m81Q-YrcP6ahjZxZQq-sRw-1 X-MC-Unique: gQST1-RrM16mUca9N-UWvQ-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=DfNQmB9tcBL0CKDZhNp2FYuozN0/Rnvy95tzXD6XqhNtk70A/BhOsaxWRw6NZxyFN/ 5YYk6ssnLYQPuaLGeJCBzXQYn6rWlMuJ1mabV1jUGqseem2DMgNAX58dhb7DUyEINZDg oXGRFPzflx56mbw/TGJKA1mjVqz/UWMFZqe5QSZFx0kBxR5X052Jm4/TDj0GiDGC8WqC vzkLUiwOoZiO0vUnpyEDL/jlQht2/F9rg8TMcueVV0+RoTPL54U+IIYjBat3SwelgJ0R OBHv9q3ikYqwIbWrg8lmeYSsNTHQXW4MZX5lhsF/Y0Szk5FDSBx1lTYJ2f/DQLrVo6Kh LOpQ== X-Gm-Message-State: AOAM531vPBKWUUKyYiBxxS+knVhVROnIkQxJwbNxjtQUgQhaHR+17Ihj HpiUsIL4pAKucnnIrKlmFi+KAa60lPODsw== X-Google-Smtp-Source: ABdhPJwxKtEwmktg0vOoTW4YU6YKNtQv187xEsO0ZNmjQMsTrXDUqXasUY1IZJk35gpRYWmqRbyoWg== X-Received: by 2002:a05:6102:242f:: with SMTP id l15mr81521450vsi.11.1637245239224; Thu, 18 Nov 2021 06:20:39 -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 11:20:19 -0300 Message-Id: <20211118142024.275704-3-danielhb413@gmail.com> In-Reply-To: <20211118142024.275704-1-danielhb413@gmail.com> References: <20211118142024.275704-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.1 X-loop: libvir-list@redhat.com Cc: danielhb413@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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1637245260826100001 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 Reviewed-by: J=C3=A1n Tomko --- 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 Thu Mar 28 19:11:11 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 1637245256074893.077029736003; Thu, 18 Nov 2021 06:20:56 -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-343-9qrTv0c9PNWz670WVF25ew-1; Thu, 18 Nov 2021 09:20:51 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3F959F92B; Thu, 18 Nov 2021 14:20:44 +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 B550368D7D; Thu, 18 Nov 2021 14:20:44 +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 83DA34E58E; Thu, 18 Nov 2021 14:20:44 +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 1AIEKgXp012985 for ; Thu, 18 Nov 2021 09:20:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id C8B55404727A; Thu, 18 Nov 2021 14:20:42 +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 C4BBB4047279 for ; Thu, 18 Nov 2021 14:20:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 ACC98811E8D for ; Thu, 18 Nov 2021 14:20:42 +0000 (UTC) Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-217-PEBZ9qh9P3m8mIME08rpyA-1; Thu, 18 Nov 2021 09:20:41 -0500 Received: by mail-ua1-f44.google.com with SMTP id o1so14017223uap.4 for ; Thu, 18 Nov 2021 06:20:41 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id b8sm1734306vsl.19.2021.11.18.06.20.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:40 -0800 (PST) X-MC-Unique: 9qrTv0c9PNWz670WVF25ew-1 X-MC-Unique: PEBZ9qh9P3m8mIME08rpyA-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=uR8+TNplW5uDE4IuvsEb2MCPv7HaM53aJlx4KMlY5LDN5d5NzvDS9ZbNqsXPrcs+XW pNrXcjHpMeAH6kRLQwfYfMgcqLESa84r7e+JmGnvhLgGBJvu0rZxFnvika/LWIx1NmN/ 1DUmHwU1M9U6zuc6H92YxjgHklPhRco2ncLv3/D428rbjkSZwhwYOfx9Fu7bwms+fQZ+ FheviNX9TE0oVkwBQNR3RD07pVk/lPAugvNQcGr2rwrph7ZeXQMnDrgrrm5RpKLvNlVu 3gKHhLDY4ThEQll6D2udGU6VOt+XhF0ywuxpHecPtXy4D0zeqYV2W9zO2ZgByUX0X8ve DYcA== X-Gm-Message-State: AOAM53084fBr4G+17HpDB3etI1n/zCX9zFOqZnXSlIn/0sf0xCO9Z4e5 JRnAwXZMbVmqhdWb6FNXmJAe1lUXkXgR5A== X-Google-Smtp-Source: ABdhPJzGjsnbzgWNyNrf+C0OU3tGA9oIUI8x5pkBxr9QR+eSY3AovWY5XB7c/2EDhpPGGU+jNGn2tg== X-Received: by 2002:ab0:3d0d:: with SMTP id f13mr38381801uax.48.1637245240523; Thu, 18 Nov 2021 06:20:40 -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 11:20:20 -0300 Message-Id: <20211118142024.275704-4-danielhb413@gmail.com> In-Reply-To: <20211118142024.275704-1-danielhb413@gmail.com> References: <20211118142024.275704-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: danielhb413@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.16 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: 1637245256340100001 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 Thu Mar 28 19:11:11 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 1637245264398865.5112355416277; Thu, 18 Nov 2021 06:21:04 -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-112-BNpuKtOOPYyXmWV13No8Cw-1; Thu, 18 Nov 2021 09:20:58 -0500 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 CEC8B1006AAC; Thu, 18 Nov 2021 14:20:48 +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 AD1F85E26A; Thu, 18 Nov 2021 14:20:48 +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 700694EA2A; Thu, 18 Nov 2021 14:20:48 +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 1AIEKj95013007 for ; Thu, 18 Nov 2021 09:20:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8C1FA404727E; Thu, 18 Nov 2021 14:20:45 +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 8806B404727D for ; Thu, 18 Nov 2021 14:20:45 +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 6FD87802802 for ; Thu, 18 Nov 2021 14:20:45 +0000 (UTC) Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-N0NxxqcfOBe-IsE7QnZmGw-1; Thu, 18 Nov 2021 09:20:44 -0500 Received: by mail-ua1-f51.google.com with SMTP id p37so13940785uae.8 for ; Thu, 18 Nov 2021 06:20:44 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id b8sm1734306vsl.19.2021.11.18.06.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:41 -0800 (PST) X-MC-Unique: BNpuKtOOPYyXmWV13No8Cw-1 X-MC-Unique: N0NxxqcfOBe-IsE7QnZmGw-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=bDnkldad2xdjDk4VnlMyFJXm4RX4O3veXUJk4ba9Q7thu7QHCyVdnnF/7rUW2Oj/al e0FO9v02yVYMxu92X6l6EPiGPoL/uOcPB4fkHD9IepAwKry4iePeXMyxdVmZ4yfDAdBn wZ020G0Iq//YuRa0UKD4/7hY2iAbjgcLR0XctDq3lIaYhMD6ZT3XyqsmtayJWIkhnJTA DITIWLn/4HWNHtwUj738hG4TrX41CofXWkMu4qKqUjwzP2nKrVcF61//w5nSc89BEiNE lHLoK/VLjEW64TAmP7hfSWrpjNDcgHAOO+Kckiv0Ui/TA9E0LsaFPRnj857juGmFoJ12 8/DA== X-Gm-Message-State: AOAM5327aJRLI6xtdU3RzgegmOJeKJ/wD8kY1715PH3CEj4VGGEXCLDX O+Weevj5DbWu+aYp+6HROEqYgZx2+DOoPg== X-Google-Smtp-Source: ABdhPJz2Qjc4leh7UUgVFc09l34BXca1twKZtqIho82eb11TMCW9wJ8aHxLZcS1gUJ/XAvGzeyDXYQ== X-Received: by 2002:a67:c181:: with SMTP id h1mr81126306vsj.3.1637245241851; Thu, 18 Nov 2021 06:20:41 -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 11:20:21 -0300 Message-Id: <20211118142024.275704-5-danielhb413@gmail.com> In-Reply-To: <20211118142024.275704-1-danielhb413@gmail.com> References: <20211118142024.275704-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: danielhb413@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.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-ZM-MESSAGEID: 1637245265378100004 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 Thu Mar 28 19:11:11 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 1637245263553312.736589905728; Thu, 18 Nov 2021 06:21:03 -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-286-OWvHgZyROUCbEZH2KZbxlw-1; Thu, 18 Nov 2021 09:21:00 -0500 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 42D3887D545; Thu, 18 Nov 2021 14:20:49 +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 220F05D9DE; Thu, 18 Nov 2021 14:20:49 +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 E2458180BAD1; Thu, 18 Nov 2021 14:20:48 +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 1AIEKl5m013016 for ; Thu, 18 Nov 2021 09:20:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id F1798404727D; Thu, 18 Nov 2021 14:20:46 +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 EDC704047279 for ; Thu, 18 Nov 2021 14:20:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 D5B51805F4A for ; Thu, 18 Nov 2021 14:20:46 +0000 (UTC) Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-11-bmMX69PTPB2SjG6rlVIdZA-1; Thu, 18 Nov 2021 09:20:45 -0500 Received: by mail-ua1-f49.google.com with SMTP id n6so14041889uak.1 for ; Thu, 18 Nov 2021 06:20:45 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id b8sm1734306vsl.19.2021.11.18.06.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:44 -0800 (PST) X-MC-Unique: OWvHgZyROUCbEZH2KZbxlw-1 X-MC-Unique: bmMX69PTPB2SjG6rlVIdZA-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=0b6+MqVvDNgybvmmJ0hYq0PlUiT2wmiSAxB2WeX6Q5A+iCTVT+fXpYiiQHhu8s4LAf AZiuUB1olsTIKRz7k69OfKJjIU4OkplONbLLWladNz00nSKmOEECOyMnwblkpTgE9RpX 2RchSMynZc99/zdcTG39b3t5sI2UIjal36XQ3hjWBgKczisvDUx3nyZGBl9igB3Yb9FL wFZ1MvvQ+6kGZA2SMi8eEz0A8WIFX1j1SjDtNkXQKDiJX1PVGeP1zLyZLDQFRmWt/crS l5DUXe5We0F+Xtu6t5pS4HRE4jbJTtY66JZjl/hV6iC6G/DyjWdHsOCTZ/hFBmmb41i7 iP9A== X-Gm-Message-State: AOAM532eeVzAUZmyYH5C4cJss17rj9NAlZA/hjmMdXRcssWOJud1+ify XM+x0RJxcHMRULN3we+bhcj0LvWGQoUIUA== X-Google-Smtp-Source: ABdhPJz8zRTbfofAbZBJCk2Tn0BMUq/UgAFUTmtxN3LBalnCzSiZbWw4O+0ZjNR4I4R1tzqaIFxQ9Q== X-Received: by 2002:a67:f1d8:: with SMTP id v24mr81946783vsm.8.1637245244601; Thu, 18 Nov 2021 06:20:44 -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 11:20:22 -0300 Message-Id: <20211118142024.275704-6-danielhb413@gmail.com> In-Reply-To: <20211118142024.275704-1-danielhb413@gmail.com> References: <20211118142024.275704-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: danielhb413@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.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-ZM-MESSAGEID: 1637245265295100001 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 Reviewed-by: J=C3=A1n Tomko --- 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 Thu Mar 28 19:11:11 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 1637245264010600.9000621178311; Thu, 18 Nov 2021 06:21:04 -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-600-UpXmovYDPRKwnnaF1GMCUw-1; Thu, 18 Nov 2021 09:21:00 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29EFFA0CAD; Thu, 18 Nov 2021 14:20:52 +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 CA58169FA3; Thu, 18 Nov 2021 14:20:51 +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 50E171832DD2; Thu, 18 Nov 2021 14:20:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIEKm3m013027 for ; Thu, 18 Nov 2021 09:20:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 244AA40CFD11; Thu, 18 Nov 2021 14:20:48 +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 1F6DD40CFD10 for ; Thu, 18 Nov 2021 14:20:48 +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 08C68185A7B4 for ; Thu, 18 Nov 2021 14:20:48 +0000 (UTC) Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-418-8Hmm6fmLMEq2YquMKtnVlw-1; Thu, 18 Nov 2021 09:20:46 -0500 Received: by mail-ua1-f52.google.com with SMTP id p37so13941068uae.8 for ; Thu, 18 Nov 2021 06:20:46 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id b8sm1734306vsl.19.2021.11.18.06.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:45 -0800 (PST) X-MC-Unique: UpXmovYDPRKwnnaF1GMCUw-1 X-MC-Unique: 8Hmm6fmLMEq2YquMKtnVlw-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=YUvp8Rx+s2hEbY6E64S8pU5kBJYGl0pZ3TKQR2near1fGyBYDu3LtBqqdNXXg/J3mh st16rRk+Qusm4PItyZDR9N/apUR9+Aig+Xcv8xSmCbvIrsmsD0P1rtbPQVPGPSmSygUr gu+/rV7V8qb297pM9hAk8FyDf83Nhp1nl1BwYoRhQzQkSTtrdEMB7QrBAUPu6sb2UK43 //+x+YbssYHN8KgZiSXDk8jLVhGTkUFWI+JtRiXOCzd7A9KB/R3Y5wT5YZFRNWA9f9/Q d7fgkxFCzq/nXDpZpKsR5pbagPrYbx5zTkzfirN/+Gb5yFbf1vI1NMiM/+QVZPIOy/7K pF3w== X-Gm-Message-State: AOAM531lUF5/B5V91m7+2iKsCBCqf2d0MLrC8wifYXwRaxSHdCBxUxlH Y2/ph5i16Nm2fOIlHFcVo38wKyago7XTqw== X-Google-Smtp-Source: ABdhPJzLqMsnLMPvGdhxOIAZknG2A6+FjpI61RRz3z7P/lXPniJ2K1srqD2T7QxPmAbMBUmRRuhI/A== X-Received: by 2002:a67:d216:: with SMTP id y22mr80660861vsi.6.1637245246039; Thu, 18 Nov 2021 06:20:46 -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 11:20:23 -0300 Message-Id: <20211118142024.275704-7-danielhb413@gmail.com> In-Reply-To: <20211118142024.275704-1-danielhb413@gmail.com> References: <20211118142024.275704-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.1 X-loop: libvir-list@redhat.com Cc: danielhb413@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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1637245265365100002 Content-Type: text/plain; charset="utf-8" The 'xmlopt' parameter can be auto-unref by using g_autoptr(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- 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 Thu Mar 28 19:11:11 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 1637245267032723.4366568645407; Thu, 18 Nov 2021 06:21:07 -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-117-xvN6_iM7OwWeJJAaHIEylA-1; Thu, 18 Nov 2021 09:21:02 -0500 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 155D5100B3AF; Thu, 18 Nov 2021 14:20:54 +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 E3C465E26A; Thu, 18 Nov 2021 14:20:53 +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 AC38A4EA2A; Thu, 18 Nov 2021 14:20:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIEKqkm013044 for ; Thu, 18 Nov 2021 09:20:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 252F951DD; Thu, 18 Nov 2021 14:20:52 +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 1F25051DC for ; Thu, 18 Nov 2021 14:20:49 +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 37C77811E84 for ; Thu, 18 Nov 2021 14:20:49 +0000 (UTC) Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-88-E9jDKE15NCuS45OgDQxBeQ-1; Thu, 18 Nov 2021 09:20:47 -0500 Received: by mail-ua1-f54.google.com with SMTP id o1so14017945uap.4 for ; Thu, 18 Nov 2021 06:20:47 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id b8sm1734306vsl.19.2021.11.18.06.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:47 -0800 (PST) X-MC-Unique: xvN6_iM7OwWeJJAaHIEylA-1 X-MC-Unique: E9jDKE15NCuS45OgDQxBeQ-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=p+7TbZwot2YqX4e7bOpS5wFy10KqEthmcKc7owIU5hM6KsVHPz7o75Ei59OgMSOt1M Yipl6z6u6UCYUxUj+8Crl+LrLrMXhB6eWQ9bDWs/OTWwyt0sUUpAIz3pgTOrqnMqhkEz 9XasITrh/B23FbFQY57ok/JJLf0x/Fq/2rSEzVwrsVr+PETeEiGFUtHXsPsgAo7m933j 0B7wDQuFXZ6OvchR5sC7HAKwotXa3sXQzjyYSsg7Xg4Pfhvt/aMVyXOmb/cBzf11/Jxh mIjgiz+01yUeUOPV13MsQgmK9byZVC9L56HVBFOrZPnfWBKEJsEVWekEfsL/Ka05EEP6 nQBw== X-Gm-Message-State: AOAM532A3ADsMEFAW0o6cFNhCUYXBux3nx05o5VrlzjHcYIqwcMx62Pj dZDX3EL6Ua7bgtNrpN52dW0h5lqulOM/5g== X-Google-Smtp-Source: ABdhPJwHTLoshjHDeuaIkkAFeK/ul2ye85Y1YwOl5HDAWW/EBisyFZRUoatKIdqms3CJr/SaibWvMQ== X-Received: by 2002:a05:6102:72a:: with SMTP id u10mr83054951vsg.9.1637245247289; Thu, 18 Nov 2021 06:20:47 -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 11:20:24 -0300 Message-Id: <20211118142024.275704-8-danielhb413@gmail.com> In-Reply-To: <20211118142024.275704-1-danielhb413@gmail.com> References: <20211118142024.275704-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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: danielhb413@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.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-ZM-MESSAGEID: 1637245268821100001 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