From nobody Sun Feb 8 06:54:15 2026 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