From nobody Sat May 4 20:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599078387; cv=none; d=zohomail.com; s=zohoarc; b=K+gp0YB4LAaNTiDoKWOXw+8sF5HVOPIrenOI+8eDGFgQddKDrfC+9kti63yaLBkOInFa7K5HbMeBmM9HIJB/xjcNPZt1ovlIhOJuNzdpvU78XszSA2WJTo4MRTx6AsHIM9hUcvm5FRIl1W7+MHXia0DRj8X4iABhqJg+i2sTvck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078387; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iXx56rDB+7ex8mCqr0ZEeATVbpAUzxDa1CJLIY3UEWE=; b=C2iu03qdJk/D/dSpJrUh7sw0gTE+dz558bxjKsX4mq465ex22cQ7DAJHRJDF6GWa1jC8mveTTfnjmPeK9DnQnXgvUSvgTXVBJEgslu2SrGK0q0ndNuQtKO0aKbXDsZr+khheAmqzh4xjaKkvNqL3rjNQQR5eSHUAFIS9WxyM7xo= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599078387778795.2281427441146; Wed, 2 Sep 2020 13:26:27 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-256-eWmLzzDhPYaYXArcSA1DxA-1; Wed, 02 Sep 2020 16:26:25 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A77E880EF9F; Wed, 2 Sep 2020 20:26:18 +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 877AD87E22; Wed, 2 Sep 2020 20:26:18 +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 58A3E79DC0; Wed, 2 Sep 2020 20:26:18 +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 082KQ27k002765 for ; Wed, 2 Sep 2020 16:26:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id C95CC200AD55; Wed, 2 Sep 2020 20:26:02 +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 C4A36200A799 for ; Wed, 2 Sep 2020 20:25:59 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8BC2A18AE949 for ; Wed, 2 Sep 2020 20:25:59 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-26-E4WOC6lQPfiTd8jAgOxu5w-1; Wed, 02 Sep 2020 16:25:57 -0400 Received: by mail-qk1-f194.google.com with SMTP id g72so986127qke.8 for ; Wed, 02 Sep 2020 13:25:57 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:25:56 -0700 (PDT) X-MC-Unique: eWmLzzDhPYaYXArcSA1DxA-1 X-MC-Unique: E4WOC6lQPfiTd8jAgOxu5w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iXx56rDB+7ex8mCqr0ZEeATVbpAUzxDa1CJLIY3UEWE=; b=b1VUrAJAFM6vGJb0fVwoIKKvanzMahy7H0dqN7RfDul3DFgHOiobBn97ER7JTHMjIc Lu7dnhnk0+MXYqRaMePxOyYchcpRTm4Rql7ckjZE4hLIXyZmKtI7y2zkD6maJXUiIVxq L4VLgXlqhbp4LDsy6ApBdCz6iSRTYoYpUTyeSepkEZ3ZzyuseuR9BqX1hM76XOZQssPO 4jY1iU3JSNJPm7p4QsGX+54bpTVEt56PvkrLE6PSwXp4+v7qLKwTVxIo7vB5YKba3PRN 1ca21vFheKqPW3BRzPLrWKMei0FOlcRDcX8XiK6O5TL5wMu5leEPdE8hMMXaRvnVvf2A 4YXQ== X-Gm-Message-State: AOAM5307J80UBkxjg3sdHdJLeHliejsKFxZvvXkBLCmEWp0+5LpBmoYD x/egHxG+qP440ZwMIhN9Yt2Wy3YKp+h3ZA== X-Google-Smtp-Source: ABdhPJyawBJMxHT88Arz05G+SbuUuyNPR53Io2zKvtkQPOeBq56+9o4DNfbOyuzNeU+cc172XJMg2Q== X-Received: by 2002:a05:620a:ed3:: with SMTP id x19mr8116135qkm.89.1599078356876; Wed, 02 Sep 2020 13:25:56 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 01/12] cpu_ppc64.c: use typedefs for 'struct ppc64_vendor' Date: Wed, 2 Sep 2020 17:25:35 -0300 Message-Id: <20200902202546.483726-2-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce virCPUppc64Vendor and virCPUppc64VendorPtr types to improve code readability. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 5b34c00a18..2a7c955781 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -34,19 +34,21 @@ VIR_LOG_INIT("cpu.cpu_ppc64"); =20 static const virArch archs[] =3D { VIR_ARCH_PPC64, VIR_ARCH_PPC64LE }; =20 -struct ppc64_vendor { +typedef struct _ppc64_vendor virCPUppc64Vendor; +typedef struct _ppc64_vendor *virCPUppc64VendorPtr; +struct _ppc64_vendor { char *name; }; =20 struct ppc64_model { char *name; - const struct ppc64_vendor *vendor; + const virCPUppc64Vendor *vendor; virCPUppc64Data data; }; =20 struct ppc64_map { size_t nvendors; - struct ppc64_vendor **vendors; + virCPUppc64VendorPtr *vendors; size_t nmodels; struct ppc64_model **models; }; @@ -142,7 +144,7 @@ ppc64DataCopy(virCPUppc64Data *dst, const virCPUppc64Da= ta *src) } =20 static void -ppc64VendorFree(struct ppc64_vendor *vendor) +ppc64VendorFree(virCPUppc64VendorPtr vendor) { if (!vendor) return; @@ -151,7 +153,7 @@ ppc64VendorFree(struct ppc64_vendor *vendor) VIR_FREE(vendor); } =20 -static struct ppc64_vendor * +static virCPUppc64VendorPtr ppc64VendorFind(const struct ppc64_map *map, const char *name) { @@ -276,7 +278,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, void *data) { struct ppc64_map *map =3D data; - struct ppc64_vendor *vendor; + virCPUppc64VendorPtr vendor; int ret =3D -1; =20 if (VIR_ALLOC(vendor) < 0) @@ -691,7 +693,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, { struct ppc64_map *map; const struct ppc64_model *model; - const struct ppc64_vendor *vendor =3D NULL; + const virCPUppc64Vendor *vendor =3D NULL; virCPUDefPtr cpu =3D NULL; size_t i; =20 @@ -705,7 +707,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, } =20 for (i =3D 0; i < ncpus; i++) { - const struct ppc64_vendor *vnd; + const virCPUppc64Vendor *vnd; =20 /* Hosts running old (<=3D 1.2.18) versions of libvirt will report * strings like 'power7+' or 'power8e' instead of proper CPU model --=20 2.26.2 From nobody Sat May 4 20:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599078379; cv=none; d=zohomail.com; s=zohoarc; b=LxVfGILr+Or/9eJ2CTrdb+lj7pHi512zvU2Gk7LacnaIOfqBVAT/HstxOf4p12xFzKZ22FqlkJc+SDqp6NJGDDgJUKRz3zU6wi7KJYD9LaQiwrP7a+Jk+HUSplSn50PF4yqUHxOwYQyMnGNwmuYENVP5ents6C1ROHmjY0jDIQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078379; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fgx4H9FjUzFeXlGlKi4GiM6ZiFWolm8atKZA8+nMN28=; b=fTo1TdoEtkpHt5J53sLfFAYojnxInFq/Ypk/+BHxKaPXpys3RoZ5mt1UOEklvZdCurQggAn2s5XcwOSQ+jw9/Jqkh7lO9HbG2/AYEL9ljiaCyBbVnNailOCMbz7kFi3FtPnWaGTh5Jr2InDW5YVHBYkNldNhE200AEvzXxPtN1k= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1599078379030830.4660089160326; Wed, 2 Sep 2020 13:26:19 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-473-VVvse3aiOBSrP-78dWylXA-1; Wed, 02 Sep 2020 16:26:15 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 78A9D1091061; Wed, 2 Sep 2020 20:26:09 +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 591085D9CC; Wed, 2 Sep 2020 20:26: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 2A7AB79DB3; Wed, 2 Sep 2020 20:26:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 082KQ51n002789 for ; Wed, 2 Sep 2020 16:26:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 994E910F26F1; Wed, 2 Sep 2020 20:26:05 +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 904ED10F26F5 for ; Wed, 2 Sep 2020 20:26:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8A31C80029D for ; Wed, 2 Sep 2020 20:26:03 +0000 (UTC) Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-498-FkZcjjdaNe2JSthcKLc7iQ-1; Wed, 02 Sep 2020 16:26:00 -0400 Received: by mail-qv1-f41.google.com with SMTP id x7so251097qvi.5 for ; Wed, 02 Sep 2020 13:26:00 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:25:57 -0700 (PDT) X-MC-Unique: VVvse3aiOBSrP-78dWylXA-1 X-MC-Unique: FkZcjjdaNe2JSthcKLc7iQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Fgx4H9FjUzFeXlGlKi4GiM6ZiFWolm8atKZA8+nMN28=; b=ntbOkFvXNcQ7QsCzMQsKTgFRyOFrFPmKHXBnwpnPbjbvet7Eu0qHUmHB7U8MoxB+n4 zmMzDSL1JoxqNRJIdzOMNjA4PCBATM5FaekILb+/bICfMieh3Y57u3TX+lHcTWeTNwDL xiAGa/dWXaFbMAFltSStYGK8/caeBn2U2ZeKaN3jvjkVtfdHoA2odmbVcA/enGtceuO/ ahrgetJPDHQxhtKmFam35JA2yW7f44vgOuQgOBLSf5BejxQhFc8A61CRNGnRmwT9M6K9 VskOo006NUS9UyHOj/GDkxNrEDoFIh1rGVhF9Ipbi9KkhxfEhHgOfzxclPcWOLE25i/k ifwA== X-Gm-Message-State: AOAM533cYwtUwW4KPmAnwv08NrHvbyLY4v7hbpiIk1cEMsTuBSBjlfA6 He6hH/mr0/i1F3Sqg2DxEoq4CShkl04QHw== X-Google-Smtp-Source: ABdhPJxp0v0qd9SmCbS1EYU+RNF4mPi4h+HUzQBncFEOaEudrWvxbhnDzZBAyNsYjkv175jFWcn3UA== X-Received: by 2002:a0c:ee41:: with SMTP id m1mr8621742qvs.214.1599078358303; Wed, 02 Sep 2020 13:25:58 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 02/12] cpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64VendorPtr Date: Wed, 2 Sep 2020 17:25:36 -0300 Message-Id: <20200902202546.483726-3-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Next patch will use g_autoptr() in virCPUppc64VendorPtr pointers for some cleanups. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 2a7c955781..b003e48bed 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -152,6 +152,7 @@ ppc64VendorFree(virCPUppc64VendorPtr vendor) VIR_FREE(vendor->name); VIR_FREE(vendor); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Vendor, ppc64VendorFree); =20 static virCPUppc64VendorPtr ppc64VendorFind(const struct ppc64_map *map, --=20 2.26.2 From nobody Sat May 4 20:29:57 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 ARC-Seal: i=1; a=rsa-sha256; t=1599078387; cv=none; d=zohomail.com; s=zohoarc; b=ZtoFvrGaVnt8j/jKHKi1oH+m+bZoq2hbViO7rqlzM2WsMd01fDk856LF94IYVv3Y1lEUqsE1QipFs55pXN19wTGa30DBLWntC59KDwwyvfDNlnXoGymFK/UlBg7/woECOPosbN2r02+b7DKKN2HHfJOFZgFLr1xq6hjttBF5QNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078387; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qDKBBf4OfImhT5ZYgYl3xDjCnBwqQPy2IOcwXA35igs=; b=CM4AjxpaLWjMvOQYEh2zkE5KtzACAZq7+dPy24UHQ0cMG0CHPIVm3nH/rLYkemNTHljBQFMAs3wtyL7cce6j19tn28FPFSQV6ebTeNdLEyAvLHwGgo2tQZjwKTBmk9ttpZbehC+uCO1H2MKR6rqfDyy9EhXlck6pv6EVo3tOUWE= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= 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 1599078387042712.7774491009407; Wed, 2 Sep 2020 13:26:27 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-389-NQ7l2_UiN1y_h-emZFYDxw-1; Wed, 02 Sep 2020 16:26:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B13DF80EFA4; Wed, 2 Sep 2020 20:26:18 +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 8DE797E30E; Wed, 2 Sep 2020 20:26:18 +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 5882E183D026; Wed, 2 Sep 2020 20:26:18 +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 082KQ5Ux002788 for ; Wed, 2 Sep 2020 16:26:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 884532157F24; Wed, 2 Sep 2020 20:26:05 +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 815C42157F26 for ; Wed, 2 Sep 2020 20:26:03 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1572102F1E3 for ; Wed, 2 Sep 2020 20:26:02 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-152-Qyvb1HLrMTOjojxOgCtnJg-1; Wed, 02 Sep 2020 16:26:00 -0400 Received: by mail-qk1-f195.google.com with SMTP id d20so1015137qka.5 for ; Wed, 02 Sep 2020 13:26:00 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:25:59 -0700 (PDT) X-MC-Unique: NQ7l2_UiN1y_h-emZFYDxw-1 X-MC-Unique: Qyvb1HLrMTOjojxOgCtnJg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qDKBBf4OfImhT5ZYgYl3xDjCnBwqQPy2IOcwXA35igs=; b=CeAvKGBK5SkL6KbRsA3KkmIOVj9uJBjT6i0axWg41bW9PtjIbvgSmnPx+7TpSAwBt6 oMr381B/yYof2ZZHQMHznrkU46QLj7MHzEQugim5/Ry37/gLPcWSteIExfoOnA8zwwh7 BMlrffs8KPVtMQkmz7RVFTu7SKcEBNBW2GOKuY7K6FvFuykureOxquY0HH8ie7jcmSJO L15MVY99mcUJAvB/LgxeGFkvcYjbX60k79RLjiCiEzxo9tTFRb3BtrdN3fJ3EO8GOjby /TkshrQsVgreVLVEPUnsdV0BIZAaLgOw24sJFgeF+HcNGfi4PswtNHuh8aL1JLyZFCAJ vyjA== X-Gm-Message-State: AOAM531jTRlU2umwevBkEwmLesL8xadGutNIBKs96gzxlTBXO3hNmBE+ r8p4GWHayNDJFye8Ugb3K8z/DPl1mY2FVg== X-Google-Smtp-Source: ABdhPJyF+SopmQ2z7GlcOMRDj028msRgbaV31erb0lLh2h2hB5zDaqBTLmQF7wM8EfLs/e3IX0YPmQ== X-Received: by 2002:ae9:dc03:: with SMTP id q3mr8712206qkf.276.1599078359943; Wed, 02 Sep 2020 13:25:59 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 03/12] cpu_ppc64.c: modernize ppc64VendorParse() Date: Wed, 2 Sep 2020 17:25:37 -0300 Message-Id: <20200902202546.483726-4-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use g_autoptr() in virCPUppc64VendorPtr and remove the now uneeded 'cleanup' label. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index b003e48bed..6c73145f06 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -279,8 +279,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, void *data) { struct ppc64_map *map =3D data; - virCPUppc64VendorPtr vendor; - int ret =3D -1; + g_autoptr(virCPUppc64Vendor) vendor =3D NULL; =20 if (VIR_ALLOC(vendor) < 0) return -1; @@ -290,17 +289,13 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSE= D, if (ppc64VendorFind(map, vendor->name)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("CPU vendor %s already defined"), vendor->name); - goto cleanup; + return -1; } =20 if (VIR_APPEND_ELEMENT(map->vendors, map->nvendors, vendor) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - ppc64VendorFree(vendor); - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Sat May 4 20:29:57 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 ARC-Seal: i=1; a=rsa-sha256; t=1599078378; cv=none; d=zohomail.com; s=zohoarc; b=PgVX6+KacxJCD7MERksSFClpbK8vkDk5c6ZNisXPczQ+IZSeVTe5QPJGdSEIO72YJt6wjhjNo08UL+YWh4eACS7UJjfPYpMeBbNiSZNlM5k5OChe79ClEmrdKO9kQ1m1lVTq0h9mPRe25oIJf/7S3mjyK5dvMAsnQrsEn2qZVPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078378; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yRdZyxjDWYtD0FtqrXVqzpxd2FgXvPr8ikkPj54gjBU=; b=WejxsDKb3CXWTDH91t6MKvuamsRWQ+EcdAIYL2SFKs0y3T3TdKoRlcR2ubvZyMoZPJ7PMadCZ+TjZRnsLrvhV/OXhnkybq/VMzHbCAAA8Rdugdjj3Eh/ZE4L8RBJGs6GxfeoEFAsD/DMamIguDMLfEtj6WziGSHjXxTtBVGL4Jo= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= 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 1599078378433457.5254217760337; Wed, 2 Sep 2020 13:26:18 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-201-MgM75iRgNcGgRRAEj8hSOg-1; Wed, 02 Sep 2020 16:26:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED6181DE18; Wed, 2 Sep 2020 20:26:07 +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 B9E8778B20; Wed, 2 Sep 2020 20:26:07 +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 CAA2C79DA2; Wed, 2 Sep 2020 20:26:06 +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 082KQ4ii002772 for ; Wed, 2 Sep 2020 16:26:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 78120200AD55; Wed, 2 Sep 2020 20:26: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 736532028DC0 for ; Wed, 2 Sep 2020 20:26:04 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A73718AE948 for ; Wed, 2 Sep 2020 20:26:04 +0000 (UTC) Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-8wS9N0ztMKWQCuL34s9Asw-1; Wed, 02 Sep 2020 16:26:02 -0400 Received: by mail-qk1-f195.google.com with SMTP id o64so970960qkb.10 for ; Wed, 02 Sep 2020 13:26:02 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:01 -0700 (PDT) X-MC-Unique: MgM75iRgNcGgRRAEj8hSOg-1 X-MC-Unique: 8wS9N0ztMKWQCuL34s9Asw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yRdZyxjDWYtD0FtqrXVqzpxd2FgXvPr8ikkPj54gjBU=; b=JXrX9ACvVr9/9UdAUyfS5/9+mNd54uOFkMSdNixecb5y+z6ytSudPF5OPUadBchrk4 U3R7deP1y783jmq4YNUSV8FLJ3NtyHcZwprDqdqrP48GRVquSeM4iEAtQ0N3F2VWV+Ck c0Izta4ZnzIvYWTurtmy2E8pLi/ONxqKCCx6vPEDT5uz/A3/docPCjIzadMJxifIu9uw O0QlyCADu1tyweqSvUaiiGQ3Ye9Is6Kok74TGzDXkJRKAIhvfjrefkgHKnLbQYb274gv 7f7sgmH1Cs985L0EPG0at3tgAjQ+rAWu853gww8K0ohAw4XlZVQ/FOwmFhy2JPgjiISo YClQ== X-Gm-Message-State: AOAM531V5eiRPtwdLsn9iON9Q5bVwoeMBUqaZ27Rub0CoF0hOA5xTo6a NPNXeGExn4gVFXVe070Z5yTgiXZEy5u7fA== X-Google-Smtp-Source: ABdhPJzTzP5G0kRVYPEQYUSwVjNZSAZUScdeWs+TKPZKsv1tReGT+K59wyzj2qwe6cg6O6L2fq83xw== X-Received: by 2002:a37:6f41:: with SMTP id k62mr8176979qkc.241.1599078361476; Wed, 02 Sep 2020 13:26:01 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 04/12] cpu_ppc64.c: use typedefs for 'struct ppc64_model' Date: Wed, 2 Sep 2020 17:25:38 -0300 Message-Id: <20200902202546.483726-5-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce virCPUppc64Model and virCPUppc64ModelPtr types to improve code readability. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 6c73145f06..7113c8ac33 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -40,7 +40,9 @@ struct _ppc64_vendor { char *name; }; =20 -struct ppc64_model { +typedef struct _ppc64_model virCPUppc64Model; +typedef struct _ppc64_model *virCPUppc64ModelPtr; +struct _ppc64_model { char *name; const virCPUppc64Vendor *vendor; virCPUppc64Data data; @@ -50,7 +52,7 @@ struct ppc64_map { size_t nvendors; virCPUppc64VendorPtr *vendors; size_t nmodels; - struct ppc64_model **models; + virCPUppc64ModelPtr *models; }; =20 /* Convert a legacy CPU definition by transforming @@ -169,7 +171,7 @@ ppc64VendorFind(const struct ppc64_map *map, } =20 static void -ppc64ModelFree(struct ppc64_model *model) +ppc64ModelFree(virCPUppc64ModelPtr model) { if (!model) return; @@ -179,10 +181,10 @@ ppc64ModelFree(struct ppc64_model *model) VIR_FREE(model); } =20 -static struct ppc64_model * -ppc64ModelCopy(const struct ppc64_model *model) +static virCPUppc64ModelPtr +ppc64ModelCopy(const virCPUppc64Model *model) { - struct ppc64_model *copy; + virCPUppc64ModelPtr copy; =20 if (VIR_ALLOC(copy) < 0) goto error; @@ -201,7 +203,7 @@ ppc64ModelCopy(const struct ppc64_model *model) return NULL; } =20 -static struct ppc64_model * +static virCPUppc64ModelPtr ppc64ModelFind(const struct ppc64_map *map, const char *name) { @@ -215,7 +217,7 @@ ppc64ModelFind(const struct ppc64_map *map, return NULL; } =20 -static struct ppc64_model * +static virCPUppc64ModelPtr ppc64ModelFindPVR(const struct ppc64_map *map, uint32_t pvr) { @@ -223,7 +225,7 @@ ppc64ModelFindPVR(const struct ppc64_map *map, size_t j; =20 for (i =3D 0; i < map->nmodels; i++) { - struct ppc64_model *model =3D map->models[i]; + virCPUppc64ModelPtr model =3D map->models[i]; for (j =3D 0; j < model->data.len; j++) { if ((pvr & model->data.pvr[j].mask) =3D=3D model->data.pvr[j].= value) return model; @@ -233,11 +235,11 @@ ppc64ModelFindPVR(const struct ppc64_map *map, return NULL; } =20 -static struct ppc64_model * +static virCPUppc64ModelPtr ppc64ModelFromCPU(const virCPUDef *cpu, const struct ppc64_map *map) { - struct ppc64_model *model; + virCPUppc64ModelPtr model; =20 if (!cpu->model) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -305,7 +307,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, void *data) { struct ppc64_map *map =3D data; - struct ppc64_model *model; + virCPUppc64ModelPtr model; xmlNodePtr *nodes =3D NULL; char *vendor =3D NULL; unsigned long pvr; @@ -428,8 +430,8 @@ ppc64Compute(virCPUDefPtr host, char **message) { struct ppc64_map *map =3D NULL; - struct ppc64_model *host_model =3D NULL; - struct ppc64_model *guest_model =3D NULL; + virCPUppc64ModelPtr host_model =3D NULL; + virCPUppc64ModelPtr guest_model =3D NULL; virCPUDefPtr cpu =3D NULL; virCPUCompareResult ret =3D VIR_CPU_COMPARE_ERROR; virArch arch; @@ -588,7 +590,7 @@ ppc64DriverDecode(virCPUDefPtr cpu, { int ret =3D -1; struct ppc64_map *map; - const struct ppc64_model *model; + const virCPUppc64Model *model; =20 if (!data || !(map =3D ppc64LoadMap())) return -1; @@ -688,7 +690,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, bool migratable G_GNUC_UNUSED) { struct ppc64_map *map; - const struct ppc64_model *model; + const virCPUppc64Model *model; const virCPUppc64Vendor *vendor =3D NULL; virCPUDefPtr cpu =3D NULL; size_t i; --=20 2.26.2 From nobody Sat May 4 20:29:57 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 ARC-Seal: i=1; a=rsa-sha256; t=1599078426; cv=none; d=zohomail.com; s=zohoarc; b=oDIbbVfEb8xYbepEwUNqEjO8Parnj+x3qIF8BrFp0WsDU+1O2Qg4WU4auFAqWDh9phBJl9X88Doexjm/7bmiL25B4jR2yZ1oPzeGmS/Npc7uDKGRYQFSuj5yjJuAL9xNvoEavHNsoI7E96ka6b5IPgHrewtI9VxrtOuRX0L7KYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078426; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xTPW2g5VmhJttahglnEzm3ZfFGAMLACx2cAMx7WQcio=; b=FAjwHJkUhAFcnV059aq81HcJIJ96EenEGHG3nHjkVuYvh9F004RXDhRvhVBbdiB0G5uhPuSBIjvU34Z85xjXrm9Da+sYN9yDmEHGAOHelw6E5z3Hv/IAUaTbQLtjDjYSUBZXYricMD/IXfuEf9THQwPtVWU3dv0psUpcbtedrBc= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= 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 1599078426478912.5483979701661; Wed, 2 Sep 2020 13:27:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-LCiQsZvdMMa2Dm-gXcAYUg-1; Wed, 02 Sep 2020 16:26:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE13581CAFE; Wed, 2 Sep 2020 20:26:20 +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 CD0827E67A; Wed, 2 Sep 2020 20:26:20 +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 992F079DC2; Wed, 2 Sep 2020 20:26:20 +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 082KQ6Je002805 for ; Wed, 2 Sep 2020 16:26:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDF8AF00D9; Wed, 2 Sep 2020 20:26:05 +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 D9AA7F00D8 for ; Wed, 2 Sep 2020 20:26:05 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BFAF5101A540 for ; Wed, 2 Sep 2020 20:26:05 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-138-MmuC0SXyMWSYFp5EbFWreg-1; Wed, 02 Sep 2020 16:26:03 -0400 Received: by mail-qk1-f194.google.com with SMTP id o64so971043qkb.10 for ; Wed, 02 Sep 2020 13:26:03 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:02 -0700 (PDT) X-MC-Unique: LCiQsZvdMMa2Dm-gXcAYUg-1 X-MC-Unique: MmuC0SXyMWSYFp5EbFWreg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xTPW2g5VmhJttahglnEzm3ZfFGAMLACx2cAMx7WQcio=; b=ZKIT1Q7LwwItJazxyJUU+2dJT9sDYCrPbbhqNDnSTDcIieu/VYyHY4UvLGqCey/AKx 6WhXEZtGg9vccP4TSosDkxOwxwsnC17AODvSONlmKbq4tnLoYUFVRKJhsXKXL/iqlcIs jA5P20HyIibAWC8V5j6Da6Z1VnMzR3NOMWb2a/sONyBXqI3hYqdhtu7ip/sLT/OJ81bV TL/7u/j4s/G+qTXGCnKermEgiLqXyea+8XlNCAnOhLkRlfMzh7QBEdr6WkYCMbZQs5db c9/f8iqlTRP46T2+Tq0YbdC9bV4gdGDy8+uSRL6Ghz1guidPQK7HY6tZjTamFckc9Fua 8h0g== X-Gm-Message-State: AOAM532izYdv8e3gae7/Wr+ye/WiiittGca7Zdt/IK6S2U5yR3XJeuK7 z2apkmJQ+aMj+o8lGQthVvFbiL/JNa+IAw== X-Google-Smtp-Source: ABdhPJyJ/uD9YqOgvLznYsWeqbcDmH1g4ttxUrClag0sEyMKO1eI/UpTUDKTBi1gDk04Qj9ZyS5ffQ== X-Received: by 2002:a37:b184:: with SMTP id a126mr7938449qkf.23.1599078362995; Wed, 02 Sep 2020 13:26:02 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 05/12] cpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64ModelPtr Date: Wed, 2 Sep 2020 17:25:39 -0300 Message-Id: <20200902202546.483726-6-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Next patch will use g_autoptr() in virCPUppc64ModelPtr pointers for some cleanups. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 7113c8ac33..02ee4b0ffd 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -180,6 +180,7 @@ ppc64ModelFree(virCPUppc64ModelPtr model) VIR_FREE(model->name); VIR_FREE(model); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Model, ppc64ModelFree); =20 static virCPUppc64ModelPtr ppc64ModelCopy(const virCPUppc64Model *model) --=20 2.26.2 From nobody Sat May 4 20:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599078390; cv=none; d=zohomail.com; s=zohoarc; b=Eq36igYpkH0qHnQQslQN704gek0HdTOlBJ7A1iMfQXLNrqq5y3cbUhs/c2RGcM59ucR4aqRr4fS2ikFaT5iYP3u/JRe1ru02Yqg+PV0Nxajtw7mjj75bZ5NYhZz/RFlEpKF5EKUm2mmOalnTe+08Jd1Yh/ewiWmrgqtF/FpepC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078390; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=91kqsUCf0EpBiWsN6CGOjsAsDIr4RQ2V5pcFkPykF1s=; b=QVbrmHOHGWyUzlcq3YlcDZfapPCPD8UOxiqcbikIcjxpRRtmQhIpIXnyyzOeiaTubU7McMDL3svz1/ETCO2n7k2smSwF+igINOQBP/GMHpf6uFXFWJTQPs5LeeWcRsAJDIwskIncx6kjQ78APFqdkHdiLGU3QwefHNa/bBltqnI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599078390626237.7685877243248; Wed, 2 Sep 2020 13:26:30 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-52-5X9aFlbUOaaiifKB-4dVKA-1; Wed, 02 Sep 2020 16:26:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19AED18A0F3E; Wed, 2 Sep 2020 20:26:22 +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 EA9F087A6C; Wed, 2 Sep 2020 20:26:21 +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 BA30A79DC7; Wed, 2 Sep 2020 20:26:21 +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 082KQ7GA002821 for ; Wed, 2 Sep 2020 16:26:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F43C2166BA2; Wed, 2 Sep 2020 20:26:07 +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 7AC3F2157F25 for ; Wed, 2 Sep 2020 20:26:07 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 60F0680121C for ; Wed, 2 Sep 2020 20:26:07 +0000 (UTC) Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-509-QzCi4Ov2MPWD6JVkvnMeLw-1; Wed, 02 Sep 2020 16:26:05 -0400 Received: by mail-qk1-f194.google.com with SMTP id w186so1042825qkd.1 for ; Wed, 02 Sep 2020 13:26:05 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:03 -0700 (PDT) X-MC-Unique: 5X9aFlbUOaaiifKB-4dVKA-1 X-MC-Unique: QzCi4Ov2MPWD6JVkvnMeLw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=91kqsUCf0EpBiWsN6CGOjsAsDIr4RQ2V5pcFkPykF1s=; b=Z3jMQYYCn0dfUj9I/3HTupQRRkT5YRqXI+D+Sa2q4XntfqnJKSER342Lq1GtCLy4Oo xxVgYoL81Wk14joc4VQBrNiRNMqcg7i9pWF2uzWPaWgGqnGy0qvCXd9xH0s8hUfNPoUs d2mqR7YIhj8UdOUXXc+k/1Em8I1itJUouKwcdXingWl8M//XAlIEbkl7O7xUxo1OX4z0 4CSaEaZuXQ8F9yViawF7510rMEpQWZwwx/XqjUNoPSQYKoEDpWwGCfYtSd+IyXZdsyTN dbEDjrRhU+WTTODYKchQJXm61CXtzrp2BBgEiFpyWT4L9u40k9PuQLAG9/kzdDaP4tX/ A/IQ== X-Gm-Message-State: AOAM532cUNOgks5QUjJQTAN+OOEjP9zHd1d02aMdaB5PRubD58p0XUpt thKFtyQy2S6GecDDB4TjIK6+Z7gBHftcqw== X-Google-Smtp-Source: ABdhPJxSlAekOadmRMYfPKAW6q9JEFCmxRd+W6MyYz91bQKYpcjwZgWvIM8Di4FbXtpnhiCI1+41bA== X-Received: by 2002:a05:620a:62c:: with SMTP id 12mr4179782qkv.59.1599078364472; Wed, 02 Sep 2020 13:26:04 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 06/12] cpu_ppc64.c: use g_autopr() with virCPUppc64ModelPtr Date: Wed, 2 Sep 2020 17:25:40 -0300 Message-Id: <20200902202546.483726-7-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use autocleanup with virCPUppc64ModelPtr to simplify existing code. Remove the 'error' label in ppc64ModelCopy() since it is now obsolete. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 02ee4b0ffd..cae96c94a1 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -185,23 +185,19 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Model, ppc64= ModelFree); static virCPUppc64ModelPtr ppc64ModelCopy(const virCPUppc64Model *model) { - virCPUppc64ModelPtr copy; + g_autoptr(virCPUppc64Model) copy =3D NULL; =20 if (VIR_ALLOC(copy) < 0) - goto error; + return NULL; =20 copy->name =3D g_strdup(model->name); =20 if (ppc64DataCopy(©->data, &model->data) < 0) - goto error; + return NULL; =20 copy->vendor =3D model->vendor; =20 - return copy; - - error: - ppc64ModelFree(copy); - return NULL; + return g_steal_pointer(©); } =20 static virCPUppc64ModelPtr @@ -308,7 +304,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, void *data) { struct ppc64_map *map =3D data; - virCPUppc64ModelPtr model; + g_autoptr(virCPUppc64Model) model =3D NULL; xmlNodePtr *nodes =3D NULL; char *vendor =3D NULL; unsigned long pvr; @@ -382,7 +378,6 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, ret =3D 0; =20 cleanup: - ppc64ModelFree(model); VIR_FREE(vendor); VIR_FREE(nodes); return ret; @@ -431,8 +426,8 @@ ppc64Compute(virCPUDefPtr host, char **message) { struct ppc64_map *map =3D NULL; - virCPUppc64ModelPtr host_model =3D NULL; - virCPUppc64ModelPtr guest_model =3D NULL; + g_autoptr(virCPUppc64Model) host_model =3D NULL; + g_autoptr(virCPUppc64Model) guest_model =3D NULL; virCPUDefPtr cpu =3D NULL; virCPUCompareResult ret =3D VIR_CPU_COMPARE_ERROR; virArch arch; @@ -545,8 +540,6 @@ ppc64Compute(virCPUDefPtr host, cleanup: virCPUDefFree(cpu); ppc64MapFree(map); - ppc64ModelFree(host_model); - ppc64ModelFree(guest_model); return ret; } =20 --=20 2.26.2 From nobody Sat May 4 20:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599078393; cv=none; d=zohomail.com; s=zohoarc; b=Ta3JnWfrAz4re6td2iP95y1NSzyfoyPYkblOuG2vAdWujCYKvoFxnbeVIXXhvWrQkDDjcYnM2bYiN7gs26gvC8/cef4O6Te3/pbKTOwfN2p9yQutbs7pby/dZdpWFQeR8y2yTpTe9686qoaAf2XwQOPLrVMi8TutFpfa5XiCru8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078393; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+TfnEwk9hg/fQwUUGcTH+YBGALT9DrQeTGoAOCJH3R0=; b=gAPY/QUdy8I8YRnTWVrBHdMTbbnLW5xYInuBnybs2mTSOERliHo7vyB0S/16KIBWUu977c3Z3z7kmHCJ79tGKGEKvLHHCuzKd21itdC1dhvt7L98mb9LGKIt2v8LPOVGa0eoKTde07NuxUCudDFbvfrhJZSIZEX5v69ecg2+YdE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1599078393797403.46502854645223; Wed, 2 Sep 2020 13:26:33 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-395-5L6O0BJmOd2_T_XA7gxsBQ-1; Wed, 02 Sep 2020 16:26:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 699D7802B45; Wed, 2 Sep 2020 20:26:24 +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 456551010405; Wed, 2 Sep 2020 20:26:24 +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 14352183D027; Wed, 2 Sep 2020 20:26:24 +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 082KQ9e3002843 for ; Wed, 2 Sep 2020 16:26:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 21C1B2157F25; Wed, 2 Sep 2020 20:26:09 +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 1CBAE2157F26 for ; Wed, 2 Sep 2020 20:26:09 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 034B280121F for ; Wed, 2 Sep 2020 20:26:09 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-336-x0VXsDR7Puy-5lLxXK-NNQ-1; Wed, 02 Sep 2020 16:26:06 -0400 Received: by mail-qt1-f195.google.com with SMTP id n18so257148qtw.0 for ; Wed, 02 Sep 2020 13:26:06 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:05 -0700 (PDT) X-MC-Unique: 5L6O0BJmOd2_T_XA7gxsBQ-1 X-MC-Unique: x0VXsDR7Puy-5lLxXK-NNQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+TfnEwk9hg/fQwUUGcTH+YBGALT9DrQeTGoAOCJH3R0=; b=msan/zubdlNkLvsPKnvPNy8/5XSPcAs6A5bA9t5Jg3GVOQtVNNo9pBRG8pKh4wiD/V bb2qp0Zgxv7zr221WPba/Hfc+QLLDDkgSlMrMMl3zo470cYjmtKlyS4RfGaMQfO5Z0FE FoMwJMzhfu6qboFuB7kkAdK3aqeOkMv8qEijSTgUN2hMdmHIRoiGl0CGdKgjwOQMRNDU D554SsgErUJdycYw20IKplnc36CElgfneX6T66ICsCsFRpS0biKsppAVNICrY5ugGf77 ShY9G+rxqgukHc7nb6R/RzrUGOcKNT175SCWWIQS3ImIRNCUZ0xJrrszRROVwlfRYhY2 VLbw== X-Gm-Message-State: AOAM532hrol9eRJ3itKqemhGwRQwpIH6Cwvd+OMsRM5TWqe829k7HKHn 8/cM8sPIpMR9lAjkdFYth7B6+jMJNi+5NQ== X-Google-Smtp-Source: ABdhPJymvxY9NCplBzcwi1Mn7mD/bxu5PLcvGBgr+Id90+B0KQ60/qS6WvoJIQeWYyvhzvwSbVvDcQ== X-Received: by 2002:ac8:7650:: with SMTP id i16mr11072qtr.268.1599078366044; Wed, 02 Sep 2020 13:26:06 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 07/12] cpu_ppc64.c: use typedefs for 'struct ppc64_map' Date: Wed, 2 Sep 2020 17:25:41 -0300 Message-Id: <20200902202546.483726-8-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Introduce virCPUppc64Map and virCPUppc64MapPtr types to improve code readability. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index cae96c94a1..261fe3dbe6 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -48,7 +48,9 @@ struct _ppc64_model { virCPUppc64Data data; }; =20 -struct ppc64_map { +typedef struct _ppc64_map virCPUppc64Map; +typedef struct _ppc64_map *virCPUppc64MapPtr; +struct _ppc64_map { size_t nvendors; virCPUppc64VendorPtr *vendors; size_t nmodels; @@ -157,7 +159,7 @@ ppc64VendorFree(virCPUppc64VendorPtr vendor) G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Vendor, ppc64VendorFree); =20 static virCPUppc64VendorPtr -ppc64VendorFind(const struct ppc64_map *map, +ppc64VendorFind(const virCPUppc64Map *map, const char *name) { size_t i; @@ -201,7 +203,7 @@ ppc64ModelCopy(const virCPUppc64Model *model) } =20 static virCPUppc64ModelPtr -ppc64ModelFind(const struct ppc64_map *map, +ppc64ModelFind(const virCPUppc64Map *map, const char *name) { size_t i; @@ -215,7 +217,7 @@ ppc64ModelFind(const struct ppc64_map *map, } =20 static virCPUppc64ModelPtr -ppc64ModelFindPVR(const struct ppc64_map *map, +ppc64ModelFindPVR(const virCPUppc64Map *map, uint32_t pvr) { size_t i; @@ -234,7 +236,7 @@ ppc64ModelFindPVR(const struct ppc64_map *map, =20 static virCPUppc64ModelPtr ppc64ModelFromCPU(const virCPUDef *cpu, - const struct ppc64_map *map) + const virCPUppc64Map *map) { virCPUppc64ModelPtr model; =20 @@ -254,7 +256,7 @@ ppc64ModelFromCPU(const virCPUDef *cpu, } =20 static void -ppc64MapFree(struct ppc64_map *map) +ppc64MapFree(virCPUppc64MapPtr map) { size_t i; =20 @@ -277,7 +279,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, const char *name, void *data) { - struct ppc64_map *map =3D data; + virCPUppc64MapPtr map =3D data; g_autoptr(virCPUppc64Vendor) vendor =3D NULL; =20 if (VIR_ALLOC(vendor) < 0) @@ -303,7 +305,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, const char *name, void *data) { - struct ppc64_map *map =3D data; + virCPUppc64MapPtr map =3D data; g_autoptr(virCPUppc64Model) model =3D NULL; xmlNodePtr *nodes =3D NULL; char *vendor =3D NULL; @@ -384,10 +386,10 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, } =20 =20 -static struct ppc64_map * +static virCPUppc64MapPtr ppc64LoadMap(void) { - struct ppc64_map *map; + virCPUppc64MapPtr map; =20 if (VIR_ALLOC(map) < 0) goto error; @@ -425,7 +427,7 @@ ppc64Compute(virCPUDefPtr host, virCPUDataPtr *guestData, char **message) { - struct ppc64_map *map =3D NULL; + virCPUppc64MapPtr map =3D NULL; g_autoptr(virCPUppc64Model) host_model =3D NULL; g_autoptr(virCPUppc64Model) guest_model =3D NULL; virCPUDefPtr cpu =3D NULL; @@ -583,7 +585,7 @@ ppc64DriverDecode(virCPUDefPtr cpu, virDomainCapsCPUModelsPtr models) { int ret =3D -1; - struct ppc64_map *map; + virCPUppc64MapPtr map; const virCPUppc64Model *model; =20 if (!data || !(map =3D ppc64LoadMap())) @@ -683,7 +685,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, const char **features G_GNUC_UNUSED, bool migratable G_GNUC_UNUSED) { - struct ppc64_map *map; + virCPUppc64MapPtr map; const virCPUppc64Model *model; const virCPUppc64Vendor *vendor =3D NULL; virCPUDefPtr cpu =3D NULL; @@ -772,7 +774,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, static int virCPUppc64DriverGetModels(char ***models) { - struct ppc64_map *map; + virCPUppc64MapPtr map; size_t i; int ret =3D -1; =20 --=20 2.26.2 From nobody Sat May 4 20:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599078388; cv=none; d=zohomail.com; s=zohoarc; b=ZxOX5de8WEkEPdAH2FhCXtfMGgbmlrX6NyBwKNGCDPJGExhF1bC/IlmqJtZoGK3z9lrKRn3V3ulCn6+GRSEqlwHgLC+p031lsK4HiLVeijCYa0p2zZ0ITfkKpRcaHgE02B8n7sgyy3QDOBh3gU6vC4TVvuP4NL02rxeyEgJZg7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078388; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lNXJVH7Wrmkc4fbstvc6LCZ7MnmgxXQma5PfiP/SgrE=; b=ErxREoWirgg2bzHf+a25Y12IW/bEGLladlTSPWdSyoPue6sIlElWKNzwxTsUQPxdZQGxZnJ/BhBB4KMZ7D7fXfDx/rAfPwBdKsP9cqtgmpue2M3FZz7115VVqqEgxYcJLbRLEzMJ8unTv/JOz36b58fhIkVIMkSTJqoPyQqEY4A= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1599078388576183.06781853630116; Wed, 2 Sep 2020 13:26:28 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-403-4Ej-waBiOP2zzl80bCKdFw-1; Wed, 02 Sep 2020 16:26:25 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0FB98030A9; Wed, 2 Sep 2020 20:26:18 +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 8DD5D78B20; Wed, 2 Sep 2020 20:26:18 +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 58D79183D027; Wed, 2 Sep 2020 20:26:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 082KQBSA002860 for ; Wed, 2 Sep 2020 16:26:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id EC29910F26F1; Wed, 2 Sep 2020 20:26:10 +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 E7CE410F26F0 for ; Wed, 2 Sep 2020 20:26:10 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D061A18AE94A for ; Wed, 2 Sep 2020 20:26:10 +0000 (UTC) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-20-vQ7M_g8SOPeb8sLphVfrww-1; Wed, 02 Sep 2020 16:26:08 -0400 Received: by mail-qt1-f195.google.com with SMTP id z2so188321qtv.12 for ; Wed, 02 Sep 2020 13:26:08 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:07 -0700 (PDT) X-MC-Unique: 4Ej-waBiOP2zzl80bCKdFw-1 X-MC-Unique: vQ7M_g8SOPeb8sLphVfrww-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lNXJVH7Wrmkc4fbstvc6LCZ7MnmgxXQma5PfiP/SgrE=; b=ftN3X3EYlsYmYnkvPE+AWSaDTJX+loUpejrSZcm8zYwKsPgDRiePe2o/tiLPKfgzyl 33qQnduXHLVznvChngHLEt6eEdcaXHjGvAhsc4TTBwvKVNPUNl4XTL1pF/bHyXWkLEGl DAizgmECSAygtKUSdzk0ZcRHdDSSkK8/6r5Qtm9ohEsYf96SWx2vcAut5z6w569Forz7 6bs+wV7zVaw1S+2LYU5sukbAL30A0KyHMCn5dtc3HaoKsacim7UGQ4eJqvYLfGrtiJUT rme1a1sB6Orh+kYkLb+e8q32wITbkB5OsOLSRKCXX01F0MZgwBvJ4olIUQ08C8X8dDmi V7WA== X-Gm-Message-State: AOAM5314W80m3Jn3fEwl7wD2QezQ5A0t8Qncsuxk8BHLf2wplyO7DwaY VLUjGBtmry8qJ+uvCveDFXeNe2Wn5LV0dw== X-Google-Smtp-Source: ABdhPJx+PFf2Gwtm4tC3+evRrm5zdjLUdoqdXw0SHAX++8tcUBUkCRI896Nv29o0Z3f8gl6GHroh0g== X-Received: by 2002:ac8:7b2e:: with SMTP id l14mr38997qtu.38.1599078367584; Wed, 02 Sep 2020 13:26:07 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 08/12] cpu_ppc64.c: register AUTOPTR_CLEANUP_FUNC for virCPUppc64MapPtr Date: Wed, 2 Sep 2020 17:25:42 -0300 Message-Id: <20200902202546.483726-9-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Next patch will use g_autoptr() in virCPUppc64MapPtr pointers for some cleanups. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 261fe3dbe6..607b5bc322 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -273,6 +273,7 @@ ppc64MapFree(virCPUppc64MapPtr map) =20 VIR_FREE(map); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Map, ppc64MapFree); =20 static int ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, --=20 2.26.2 From nobody Sat May 4 20:29:57 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 ARC-Seal: i=1; a=rsa-sha256; t=1599078424; cv=none; d=zohomail.com; s=zohoarc; b=d4S7cr0VLERp+xZwrVm3w2XLM7LJP5TROSpKKG3SQwVaWKXuk54ko6TbHipD/sMge7Z35f8EygpwbUvEiqOr2tq+J7OaL9/mhsTzqP25kp7q1DPn5i1PQmbfy9ER/GbiLUHwiawE3p7vo14D42NxYuOqgVcYWqWJH+hHqtokzuE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078424; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M3YFHlSrZ9TelXjwJwmnFi9NYAiX+RjKjk+8SBl0IQc=; b=MBDfaUy6j3MCm/5XHw66oxjEOg+XIlcMw2yx7A3+clc13ItHt5tNTVYr6tdCXyzJxGZU2IakwgpibJ9wBlV2oMsaBQyrZpJakkK/gzw4S7UOy/sEy9bEr4M2+QME3jUI+5QmUV0KIW7/9MTOWQJJ8jvsPIHagPR5hY/dDEGvlEw= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= 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 1599078424312225.44191932965566; Wed, 2 Sep 2020 13:27:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-488-qM4vj-tuOVGzB7q2KrZmRg-1; Wed, 02 Sep 2020 16:26:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 241361091068; Wed, 2 Sep 2020 20:26:21 +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 039D77E315; Wed, 2 Sep 2020 20:26:21 +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 C2CE779DBC; Wed, 2 Sep 2020 20:26:20 +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 082KQDsU002873 for ; Wed, 2 Sep 2020 16:26:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id E98EBF00D9; Wed, 2 Sep 2020 20:26:12 +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 E5090EE85C for ; Wed, 2 Sep 2020 20:26:12 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CB9DB811E7A for ; Wed, 2 Sep 2020 20:26:12 +0000 (UTC) Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-45-FhRKmRdzPKGLBYZv1J9GzA-1; Wed, 02 Sep 2020 16:26:09 -0400 Received: by mail-qv1-f66.google.com with SMTP id di5so220464qvb.13 for ; Wed, 02 Sep 2020 13:26:09 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:08 -0700 (PDT) X-MC-Unique: qM4vj-tuOVGzB7q2KrZmRg-1 X-MC-Unique: FhRKmRdzPKGLBYZv1J9GzA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M3YFHlSrZ9TelXjwJwmnFi9NYAiX+RjKjk+8SBl0IQc=; b=jKlEtuUrKRsul3jEwbDpMJhMCp1ov2jHrl65qtqrTkG85WEEwHHZZAP5U/fpj/qeh0 bFCg7TGo2Am3JSApW4T4OIAkx/xp6NhOtMKbd1GWI9jmX+YdMsB9dJBQV7ynJg7MaOUr PxYhjNGVFLCcfODux5+9e42BAzlKvZBKqP+4srCDrQbuWcyRVaFqmmbkj2djnTKJdFJX 5pg4S5wfLNNar+xAST/B4dxZvCI1i0GH1t1ChMYAanVj2kwLQeskRO6GwKT1J3sAinRA USPoDlNcdX0K1kFGMMuNqhHyQ14GpQ/LadckGluaSRlfTEn9+fJhJk6PxuutQwzQXcGh nl2A== X-Gm-Message-State: AOAM533wbsUWUtffbdZM1OE/Hgy0Fv4M+2VmVCBPRRNj8lfEkInWyqhl Hou0OYyvsB49bxMZ8uSZdcFFAf17zn1h5g== X-Google-Smtp-Source: ABdhPJzp52370XTjRuYT8KH4tlg53mNLo7SLgQPWeEUK9eqYRKJ+Hsjk4jO+SgRdXXXbrr6E+VcNnA== X-Received: by 2002:a05:6214:289:: with SMTP id l9mr8347749qvv.137.1599078369025; Wed, 02 Sep 2020 13:26:09 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 09/12] cpu_ppc64.c: use g_autopr() with virCPUppc64MapPtr Date: Wed, 2 Sep 2020 17:25:43 -0300 Message-Id: <20200902202546.483726-10-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use autocleanup with virCPUppc64MapPtr to simplify existing code. Remove labels when possible. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 47 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 607b5bc322..b7c4864200 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -390,19 +390,15 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, static virCPUppc64MapPtr ppc64LoadMap(void) { - virCPUppc64MapPtr map; + g_autoptr(virCPUppc64Map) map =3D NULL; =20 if (VIR_ALLOC(map) < 0) - goto error; + return NULL; =20 if (cpuMapLoad("ppc64", ppc64VendorParse, NULL, ppc64ModelParse, map) = < 0) - goto error; - - return map; + return NULL; =20 - error: - ppc64MapFree(map); - return NULL; + return g_steal_pointer(&map); } =20 static virCPUDataPtr @@ -428,7 +424,7 @@ ppc64Compute(virCPUDefPtr host, virCPUDataPtr *guestData, char **message) { - virCPUppc64MapPtr map =3D NULL; + g_autoptr(virCPUppc64Map) map =3D NULL; g_autoptr(virCPUppc64Model) host_model =3D NULL; g_autoptr(virCPUppc64Model) guest_model =3D NULL; virCPUDefPtr cpu =3D NULL; @@ -542,7 +538,6 @@ ppc64Compute(virCPUDefPtr host, =20 cleanup: virCPUDefFree(cpu); - ppc64MapFree(map); return ret; } =20 @@ -585,8 +580,7 @@ ppc64DriverDecode(virCPUDefPtr cpu, const virCPUData *data, virDomainCapsCPUModelsPtr models) { - int ret =3D -1; - virCPUppc64MapPtr map; + g_autoptr(virCPUppc64Map) map =3D NULL; const virCPUppc64Model *model; =20 if (!data || !(map =3D ppc64LoadMap())) @@ -596,26 +590,21 @@ ppc64DriverDecode(virCPUDefPtr cpu, virReportError(VIR_ERR_OPERATION_FAILED, _("Cannot find CPU model with PVR 0x%08x"), data->data.ppc64.pvr[0].value); - goto cleanup; + return -1; } =20 if (!virCPUModelIsAllowed(model->name, models)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("CPU model %s is not supported by hypervisor"), model->name); - goto cleanup; + return -1; } =20 cpu->model =3D g_strdup(model->name); if (model->vendor) cpu->vendor =3D g_strdup(model->vendor->name); =20 - ret =3D 0; - - cleanup: - ppc64MapFree(map); - - return ret; + return 0; } =20 static void @@ -686,7 +675,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, const char **features G_GNUC_UNUSED, bool migratable G_GNUC_UNUSED) { - virCPUppc64MapPtr map; + g_autoptr(virCPUppc64Map) map =3D NULL; const virCPUppc64Model *model; const virCPUppc64Vendor *vendor =3D NULL; virCPUDefPtr cpu =3D NULL; @@ -761,23 +750,19 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, cpu->match =3D VIR_CPU_MATCH_EXACT; cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; =20 - cleanup: - ppc64MapFree(map); - return cpu; =20 error: virCPUDefFree(cpu); cpu =3D NULL; - goto cleanup; + return NULL; } =20 static int virCPUppc64DriverGetModels(char ***models) { - virCPUppc64MapPtr map; + g_autoptr(virCPUppc64Map) map =3D NULL; size_t i; - int ret =3D -1; =20 if (!(map =3D ppc64LoadMap())) goto error; @@ -790,18 +775,14 @@ virCPUppc64DriverGetModels(char ***models) (*models)[i] =3D g_strdup(map->models[i]->name); } =20 - ret =3D map->nmodels; - - cleanup: - ppc64MapFree(map); - return ret; + return map->nmodels; =20 error: if (models) { g_strfreev(*models); *models =3D NULL; } - goto cleanup; + return -1; } =20 struct cpuArchDriver cpuDriverPPC64 =3D { --=20 2.26.2 From nobody Sat May 4 20:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599078393; cv=none; d=zohomail.com; s=zohoarc; b=E/Gv15b8GOWoHI8j3E9GgvAH+DtPTNJVWo5utbxF057XzRNJvmu7/g+RlPyc71AUc2D6HrO3JoXyA5xsreOop/Qw7MmdeRGJJa7cQ5yjWe3fgEZeYetGdNEWaLQ4Urain057K67d0COzxbNrMz8JGzE4kO57RwGAa9zLRkw3WGw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078393; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iCNEvcY9Q819E6JrQBu3c0SOIDW2ah8G7ckZNXS4kCY=; b=ZNVkzgKt09A3eXGZDP4qlQdNdoijE4sHnRingLmY54IpsaayyA07LKJxYPWJ4FOoL2ANwZbMoKHfdXzYffv+P8HWhPQ0W9xLsEgD3V5gy8ABF6bwYuo8iXHQcy6xHlzSXtXzfgrRpO0Z+UOJigdv38VDeO2BVJG0r+3K6JPJGy8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1599078393487808.445853355139; Wed, 2 Sep 2020 13:26:33 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-467-5mPsT7QUOrSXmYhfDz0mZg-1; Wed, 02 Sep 2020 16:26:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5852F81CAFA; Wed, 2 Sep 2020 20:26:23 +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 39F3D87A6C; Wed, 2 Sep 2020 20:26: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 05F40183D020; Wed, 2 Sep 2020 20:26:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 082KQDUw002885 for ; Wed, 2 Sep 2020 16:26:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id A053210F26F0; Wed, 2 Sep 2020 20:26:13 +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 9B51810F26F2 for ; Wed, 2 Sep 2020 20:26:13 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 81CCA18AE94A for ; Wed, 2 Sep 2020 20:26:13 +0000 (UTC) Received: from mail-qv1-f67.google.com (mail-qv1-f67.google.com [209.85.219.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-327-ts4RQBDKOMKHx8GHzT8Mxg-1; Wed, 02 Sep 2020 16:26:11 -0400 Received: by mail-qv1-f67.google.com with SMTP id x7so251427qvi.5 for ; Wed, 02 Sep 2020 13:26:11 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:09 -0700 (PDT) X-MC-Unique: 5mPsT7QUOrSXmYhfDz0mZg-1 X-MC-Unique: ts4RQBDKOMKHx8GHzT8Mxg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iCNEvcY9Q819E6JrQBu3c0SOIDW2ah8G7ckZNXS4kCY=; b=hKGXL5OotuCiBGFu9GaCogwKu2kyYKsc4iSSRhqzLoSizlM0TRFpQrisgP0+2ltMUK O/1rvDzdgFOGLvZFNswcRn+V6uHtCvJO8+zKU/FTlsGiZPMoDbAlMcIxjuN0FrwEcNZv 7coh8rRBEor1ER7cDVQQCo33QY8rlD3Yb7wCl/Zplvn/EqWcY8vuT9B/b3ZEHU58XijZ 4pZIxwYNuyw41ICpRLQ31NM9Mb7pPS6ExFHKykYC+3Y9F2r9J62LoxdOCtPKCPR4lzSS d0Gqmum4K0mrwo8WKtZYwhcRVhpU+BEq1emKbtq6NGWHbKYGw/Pf5+yC5VdSVp1QC0s3 8ZDQ== X-Gm-Message-State: AOAM530vtUdaQYNtf9S1vv+63gCGRZyZv0Ua/YpEMVfdVIzwJGksaTFh f0Xy+XmS60WcqDT7Ad7r1IQLavImf/tBFg== X-Google-Smtp-Source: ABdhPJwU6VWhz2TYq5z1uvbxGfQGywUvVoaCJ0M/oby4HxjkIB36tKJrZlGDzrkE0xNxjKJo3SWgjg== X-Received: by 2002:ad4:4973:: with SMTP id p19mr7967654qvy.108.1599078370421; Wed, 02 Sep 2020 13:26:10 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 10/12] cpu_ppc64.c: use g_autoptr() in virCPUppc64GetHost() Date: Wed, 2 Sep 2020 17:25:44 -0300 Message-Id: <20200902202546.483726-11-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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.3 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" We don't need to call virCPUppc64DataFree() in a cleanup label. This function is already assigned to the 'dataFree' interface of cpuDriverPPC64, and it will be called by virCPUDataFree(), the autocleanup function of virCPUDataPtr, via driver->dataFree. Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index b7c4864200..bc9d399939 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -622,17 +622,16 @@ static int virCPUppc64GetHost(virCPUDefPtr cpu, virDomainCapsCPUModelsPtr models) { - virCPUDataPtr cpuData =3D NULL; + g_autoptr(virCPUData) cpuData =3D NULL; virCPUppc64Data *data; - int ret =3D -1; =20 if (!(cpuData =3D virCPUDataNew(archs[0]))) - goto cleanup; + return -1; =20 data =3D &cpuData->data.ppc64; =20 if (VIR_ALLOC_N(data->pvr, 1) < 0) - goto cleanup; + return -1; =20 data->len =3D 1; =20 @@ -642,11 +641,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu, #endif data->pvr[0].mask =3D 0xfffffffful; =20 - ret =3D ppc64DriverDecode(cpu, cpuData, models); - - cleanup: - virCPUppc64DataFree(cpuData); - return ret; + return ppc64DriverDecode(cpu, cpuData, models); } =20 =20 --=20 2.26.2 From nobody Sat May 4 20:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599078396; cv=none; d=zohomail.com; s=zohoarc; b=ZgBf2O5z5W/cHlJPyct3n4Lq5vHpqXQWyQewLU+SnEHwnMuHSGYJ/BxlGzZIZrSboBgL1KbfQ8OydzYHjPFrdBgEGUD++CLftUWq7kAEBl3Ko70LRrZHphtADHkBOrWMPIS+B4P1uJFiwuigebxbL3DHCe5eKpkBjnSb0zU30nY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078396; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d0JBp9pXCb7wOUeXHyXbgInPIsauxuPMX/C3MfpRyhw=; b=lxyP0xVadqdbJ+U1qMgaYHSH8jG3FmbIIAc23/Mw5oMkxY9EMGe4KO+uboT9vkA4e2y9aX21gynF80odu4ANTVD7lcyVym5/iQ7NIx0/PEA3s94FkJBl0cgmvd0WpUKT4aIzJ7uuUhkspvTOipYW7QuczDW8gZkojO+qHN1g/yU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1599078396018704.0831164067145; Wed, 2 Sep 2020 13:26:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-512-UGlvJ64gMKaeG8bmu1YkVQ-1; Wed, 02 Sep 2020 16:26:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D00921091070; Wed, 2 Sep 2020 20:26:25 +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 B15F67EEB7; Wed, 2 Sep 2020 20:26: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 7FF1E183D02C; Wed, 2 Sep 2020 20:26:25 +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 082KQF7p002904 for ; Wed, 2 Sep 2020 16:26:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 264432157F25; Wed, 2 Sep 2020 20:26:15 +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 1FF832166BDD for ; Wed, 2 Sep 2020 20:26:15 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 06CED18AE948 for ; Wed, 2 Sep 2020 20:26:15 +0000 (UTC) Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-293-oMNFqdg9PSG8jQR9ESXIIw-1; Wed, 02 Sep 2020 16:26:12 -0400 Received: by mail-qt1-f173.google.com with SMTP id d27so235793qtg.4 for ; Wed, 02 Sep 2020 13:26:12 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:11 -0700 (PDT) X-MC-Unique: UGlvJ64gMKaeG8bmu1YkVQ-1 X-MC-Unique: oMNFqdg9PSG8jQR9ESXIIw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d0JBp9pXCb7wOUeXHyXbgInPIsauxuPMX/C3MfpRyhw=; b=Qkv0fUD7r3W/EeMM8qbM9tRdetIqDQauWbsij4yH4+TFciR+dqS/zvi1kGM7wblMgK 97N1v1y9zfxTRpyns7nlBhP2Qteh3qeZTXG/ca9P97vt2nW32TGUzy+BeTJLFMEtxqTA FCCETtzmhYfiGc7ryDARjl8surOzV6ecKYLzfjfWx5vTl/E0umefJH0PXKwtdiDaAf0V Da56jajPyDKYdx3iIbAzHDMXHpo0UK2C7U3annIx3t1qlBj1F2tsD0XwUY697I6H0o81 Ox4J2JymE5LoDVnUwNm0HV9MSAYSkKUPXcgiI/q4XFVS2AlPKV2iLzzpQhLVamF/WFEY MAxA== X-Gm-Message-State: AOAM533n05J342mmFS1J2gJMUazbVWR3NK1hiyel2GzT6L/hIFSOI3ay nkhf8yPaIvC8ikSUWJs5m+CZmI3W3sSLYw== X-Google-Smtp-Source: ABdhPJyjKRp4zkKnZq80BNlhqY8wP3JU87zIJMpgC/ucprxyMDD2DS01dz4gLbhWJIWbnk43W6lQYw== X-Received: by 2002:ac8:75ca:: with SMTP id z10mr8417300qtq.345.1599078371873; Wed, 02 Sep 2020 13:26:11 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 11/12] cpu_ppc64.c: use g_autofree() whenever possible Date: Wed, 2 Sep 2020 17:25:45 -0300 Message-Id: <20200902202546.483726-12-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This allows for a label removal in ppc64ModelParse(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index bc9d399939..0c140b33e4 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -308,22 +308,21 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, { virCPUppc64MapPtr map =3D data; g_autoptr(virCPUppc64Model) model =3D NULL; - xmlNodePtr *nodes =3D NULL; - char *vendor =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; + g_autofree char *vendor =3D NULL; unsigned long pvr; size_t i; int n; - int ret =3D -1; =20 if (VIR_ALLOC(model) < 0) - goto cleanup; + return -1; =20 model->name =3D g_strdup(name); =20 if (ppc64ModelFind(map, model->name)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("CPU model %s already defined"), model->name); - goto cleanup; + return -1; } =20 if (virXPathBoolean("boolean(./vendor)", ctxt)) { @@ -332,14 +331,14 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid vendor element in CPU model %s"), model->name); - goto cleanup; + return -1; } =20 if (!(model->vendor =3D ppc64VendorFind(map, vendor))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown vendor %s referenced by CPU model %s= "), vendor, model->name); - goto cleanup; + return -1; } } =20 @@ -347,11 +346,11 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing PVR information for CPU model %s"), model->name); - goto cleanup; + return -1; } =20 if (VIR_ALLOC_N(model->data.pvr, n) < 0) - goto cleanup; + return -1; =20 model->data.len =3D n; =20 @@ -362,7 +361,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing or invalid PVR value in CPU model %s= "), model->name); - goto cleanup; + return -1; } model->data.pvr[i].value =3D pvr; =20 @@ -370,20 +369,15 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_INTERNAL_ERROR, _("Missing or invalid PVR mask in CPU model %s"= ), model->name); - goto cleanup; + return -1; } model->data.pvr[i].mask =3D pvr; } =20 if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - VIR_FREE(vendor); - VIR_FREE(nodes); - return ret; + return 0; } =20 =20 @@ -547,7 +541,7 @@ virCPUppc64Compare(virCPUDefPtr host, bool failIncompatible) { virCPUCompareResult ret; - char *message =3D NULL; + g_autofree char *message =3D NULL; =20 if (!host || !host->model) { if (failIncompatible) { @@ -570,7 +564,6 @@ virCPUppc64Compare(virCPUDefPtr host, virReportError(VIR_ERR_CPU_INCOMPATIBLE, NULL); } } - VIR_FREE(message); =20 return ret; } --=20 2.26.2 From nobody Sat May 4 20:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1599078396; cv=none; d=zohomail.com; s=zohoarc; b=mLUteS9Lf98kk2kzflPVyIqpKE4CU289znf5v7uTtUta0MjlbLO/j/G+d9kT+r9ie4r1ZcyxfpKJzCwiCb0zliVL7ZpAD1L8k7Gj6mOyqVDaEMSloHSLhVeggmcmOhjsbVHjMR03KHyxe13qJmLoDFJtRakeyNzn4/Sy2j6XBK4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599078396; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=B9oY1lHbAIfAiGaJhnAVkjJeKwqLaXSOZK8ofAJ72gQ=; b=igIYoHxiV+mj6DSHzOSGAEEX/ckuqmVvagyyFU4hmboSXWa00LZ+fnROmXRPMJOzAx8QhwUF/a+RAQckgy/PmInyBLVcmcZEqs/kwgqYdLYA4MQoPjYb27d5YT9b4gVNx/nGpwdCXS0VS0VD3RduVVnAxzN2UYgU3GC8J801zvc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1599078396860286.5136736231922; Wed, 2 Sep 2020 13:26:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-475-iZBN2dEyPoq3EG0j0i1_qw-1; Wed, 02 Sep 2020 16:26:34 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3DA0B1091062; Wed, 2 Sep 2020 20:26:27 +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 1C7F965F5E; Wed, 2 Sep 2020 20:26:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E0D3C79DCA; Wed, 2 Sep 2020 20:26:26 +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 082KQGAC002912 for ; Wed, 2 Sep 2020 16:26:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E7AE200A4F4; Wed, 2 Sep 2020 20:26:16 +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 696DE2028DC0 for ; Wed, 2 Sep 2020 20:26:16 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F2FE80121F for ; Wed, 2 Sep 2020 20:26:16 +0000 (UTC) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-214-vr_xbmphOGq5rSBdywTljA-1; Wed, 02 Sep 2020 16:26:14 -0400 Received: by mail-qv1-f51.google.com with SMTP id j3so242298qvi.7 for ; Wed, 02 Sep 2020 13:26:14 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c7:d5bb:61e:5265:e62b:1233]) by smtp.gmail.com with ESMTPSA id b187sm547176qkd.107.2020.09.02.13.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 13:26:13 -0700 (PDT) X-MC-Unique: iZBN2dEyPoq3EG0j0i1_qw-1 X-MC-Unique: vr_xbmphOGq5rSBdywTljA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B9oY1lHbAIfAiGaJhnAVkjJeKwqLaXSOZK8ofAJ72gQ=; b=JcdX/xTkiSCdhEzApebuswSfhlrWykjnvoYiYYXJIb8/4HsWUk7hcylSNvan+VrqAU /v/b4cyWfLFSKxHADCbJVwni8IVPmNFtUupz5rO/qu2BT9WwufcEzEEUa1ApbbyeKv9V 9WPUrftDPHmb/ObhPBkxYzESmw8tZoJNUa+IZ4pMH46hIbxhqlpXYW29g+u2oAViOMkG Iqs8h6/E4oesiQMrFVs39OUjMxvSOvfecOYqO6zh3Q5LsD/RtkGlGVn3nXvpKL2BH9Ix oHntgN+lMoknOQ17g2uFLHCk1+lcCJH/9GVE3hiTnJV2ixan7188G4mKJC7ydW0ib5zx M7wg== X-Gm-Message-State: AOAM532ckVtKy9oy6rSKdFWFnTh147dcAF9HzIQsMhAkFGdARZ4UYHGj eFBsXVEniNIUiAqAmlTPnBX8xSSTbZmgOQ== X-Google-Smtp-Source: ABdhPJwK4fgjFv4lxmek4RhUX3+HMsuukNY9YHyBuCf9065xRb8mw6O2IwbxQvaWXJaRMJdKNEI3Tw== X-Received: by 2002:ad4:5749:: with SMTP id q9mr8588536qvx.56.1599078373426; Wed, 02 Sep 2020 13:26:13 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 12/12] cpu_ppc64.c: use g_autoptr() whenever possible Date: Wed, 2 Sep 2020 17:25:46 -0300 Message-Id: <20200902202546.483726-13-danielhb413@gmail.com> In-Reply-To: <20200902202546.483726-1-danielhb413@gmail.com> References: <20200902202546.483726-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: Daniel Henrique Barboza 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Using g_autoptr() in virCPUDef pointers allows for more cleanups in ppc64Compute() and virCPUppc64Baseline() Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 55 +++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 0c140b33e4..9e6f1e856e 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -421,15 +421,14 @@ ppc64Compute(virCPUDefPtr host, g_autoptr(virCPUppc64Map) map =3D NULL; g_autoptr(virCPUppc64Model) host_model =3D NULL; g_autoptr(virCPUppc64Model) guest_model =3D NULL; - virCPUDefPtr cpu =3D NULL; - virCPUCompareResult ret =3D VIR_CPU_COMPARE_ERROR; + g_autoptr(virCPUDef) cpu =3D NULL; virArch arch; size_t i; =20 /* Ensure existing configurations are handled correctly */ if (!(cpu =3D virCPUDefCopy(other)) || virCPUppc64ConvertLegacy(cpu) < 0) - goto cleanup; + return VIR_CPU_COMPARE_ERROR; =20 if (cpu->arch !=3D VIR_ARCH_NONE) { bool found =3D false; @@ -448,8 +447,7 @@ ppc64Compute(virCPUDefPtr host, *message =3D g_strdup_printf(_("CPU arch %s does not match= host arch"), virArchToString(cpu->arch)); =20 - ret =3D VIR_CPU_COMPARE_INCOMPATIBLE; - goto cleanup; + return VIR_CPU_COMPARE_INCOMPATIBLE; } arch =3D cpu->arch; } else { @@ -466,16 +464,15 @@ ppc64Compute(virCPUDefPtr host, cpu->vendor); } =20 - ret =3D VIR_CPU_COMPARE_INCOMPATIBLE; - goto cleanup; + return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 if (!(map =3D ppc64LoadMap())) - goto cleanup; + return VIR_CPU_COMPARE_ERROR; =20 /* Host CPU information */ if (!(host_model =3D ppc64ModelFromCPU(host, map))) - goto cleanup; + return VIR_CPU_COMPARE_ERROR; =20 if (cpu->type =3D=3D VIR_CPU_TYPE_GUEST) { /* Guest CPU information */ @@ -485,10 +482,8 @@ ppc64Compute(virCPUDefPtr host, /* host-model only: * we need to take compatibility modes into account */ tmp =3D ppc64CheckCompatibilityMode(host->model, cpu->model); - if (tmp !=3D VIR_CPU_COMPARE_IDENTICAL) { - ret =3D tmp; - goto cleanup; - } + if (tmp !=3D VIR_CPU_COMPARE_IDENTICAL) + return tmp; G_GNUC_FALLTHROUGH; =20 case VIR_CPU_MODE_HOST_PASSTHROUGH: @@ -509,7 +504,7 @@ ppc64Compute(virCPUDefPtr host, } =20 if (!guest_model) - goto cleanup; + return VIR_CPU_COMPARE_ERROR; =20 if (STRNEQ(guest_model->name, host_model->name)) { VIR_DEBUG("host CPU model does not match required CPU model %s", @@ -520,19 +515,14 @@ ppc64Compute(virCPUDefPtr host, guest_model->name); } =20 - ret =3D VIR_CPU_COMPARE_INCOMPATIBLE; - goto cleanup; + return VIR_CPU_COMPARE_INCOMPATIBLE; } =20 if (guestData) if (!(*guestData =3D ppc64MakeCPUData(arch, &guest_model->data))) - goto cleanup; + return VIR_CPU_COMPARE_ERROR; =20 - ret =3D VIR_CPU_COMPARE_IDENTICAL; - - cleanup: - virCPUDefFree(cpu); - return ret; + return VIR_CPU_COMPARE_IDENTICAL; } =20 static virCPUCompareResult @@ -666,16 +656,16 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, g_autoptr(virCPUppc64Map) map =3D NULL; const virCPUppc64Model *model; const virCPUppc64Vendor *vendor =3D NULL; - virCPUDefPtr cpu =3D NULL; + g_autoptr(virCPUDef) cpu =3D NULL; size_t i; =20 if (!(map =3D ppc64LoadMap())) - goto error; + return NULL; =20 if (!(model =3D ppc64ModelFind(map, cpus[0]->model))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown CPU model %s"), cpus[0]->model); - goto error; + return NULL; } =20 for (i =3D 0; i < ncpus; i++) { @@ -695,7 +685,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, if (STRNEQ(cpus[i]->model, model->name)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("CPUs are incompatible")); - goto error; + return NULL; } =20 if (!cpus[i]->vendor) @@ -704,7 +694,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, if (!(vnd =3D ppc64VendorFind(map, cpus[i]->vendor))) { virReportError(VIR_ERR_OPERATION_FAILED, _("Unknown CPU vendor %s"), cpus[i]->vendor); - goto error; + return NULL; } =20 if (model->vendor) { @@ -714,13 +704,13 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, "vendor %s"), model->vendor->name, model->name, vnd->name); - goto error; + return NULL; } } else if (vendor) { if (vendor !=3D vnd) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("CPU vendors do not match")); - goto error; + return NULL; } } else { vendor =3D vnd; @@ -738,12 +728,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, cpu->match =3D VIR_CPU_MATCH_EXACT; cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; =20 - return cpu; - - error: - virCPUDefFree(cpu); - cpu =3D NULL; - return NULL; + return g_steal_pointer(&cpu); } =20 static int --=20 2.26.2