From nobody Mon Apr 29 07:32:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599491066; cv=none; d=zohomail.com; s=zohoarc; b=S3HqEPmyUIbwSs5Sd3iz9DJAaWx5GDr6mlVvqOs4f7FeuTtrGM9RqqhR/vNFNl/Y2MrZ63FaOwPQziEzwcoaSXNtUMDWrKebsc0WFHmyrzqZJp+T5MURrh7xuu30v3208JJw+uTeojIb+16cUOvKHVHXgYcP7W3M+VLOWQZFX7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599491066; 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=aXYHf7LBPQnqrw+zJMtA7CPTMDwugrdSJ7nDEYu7KuM=; b=RLQmOZ/6wcp57qQEIqFaETeJCnXHhQg29P9FgQ+KmxQddv5qTesaCvjWI7TO2h4sxxy+pt3HL789XoT3R5VICjDbiA04VvZCWlRWhnH5C5pyLG9Z3HsTVKwcRFC6lp0mRce+8GGcTMHIvtZ20ZEmph6YyNGxQOnMjsjsV4q9wA0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1599491066276914.574528672702; Mon, 7 Sep 2020 08:04:26 -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-73-NyKbDpxePaitMLgDNIUirA-1; Mon, 07 Sep 2020 10:59:22 -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 CA5101084C8A; Mon, 7 Sep 2020 14:59:15 +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 A97245D9E2; Mon, 7 Sep 2020 14:59:15 +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 78AED79FEA; Mon, 7 Sep 2020 14:59:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExCAR030516 for ; Mon, 7 Sep 2020 10:59:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 540F51A8EC; Mon, 7 Sep 2020 14:59:12 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9194B27BD8; Mon, 7 Sep 2020 14:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490764; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aXYHf7LBPQnqrw+zJMtA7CPTMDwugrdSJ7nDEYu7KuM=; b=TlfyEVqPX+cDozpJHW2QLAo3IRqCznZQ22ZxClCTo5Kw0t/FlHms2c+0Slzijh+Od5XdKT dE9NgkFDcAQg41O0UWmvkFHBW3+MgBMgYPlWSc416hDT5uc3r+CeFdvXDrq9n+MClqpzHW XpHOHGDFdeqXHEe2dA+YnySY4Zu1V40= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599491064; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aXYHf7LBPQnqrw+zJMtA7CPTMDwugrdSJ7nDEYu7KuM=; b=Q8ldfYAZJmKFe/kVl87dB5nsqHVIGFKtfEzlTD1mP1zbOTeYFOcie2fZJh9KC+6GifESwH hNsJbqswxy3liTzQ2iJJDZLbwZi3cMrM4zGPRyoy0pn8zMuFQ0sQTVazCQo4zRJVsY0GdB M9Z7mZzZnRt+xxgZ7/1NZwea5QCPcUU= X-MC-Unique: NyKbDpxePaitMLgDNIUirA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/15] cpu_map: Use g_auto* in loadData Date: Mon, 7 Sep 2020 16:58:52 +0200 Message-Id: <20200907145906.426709-2-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_map.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index cbf90d1395..c315ab32b2 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -32,6 +32,8 @@ =20 VIR_LOG_INIT("cpu.cpu_map"); =20 +G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlNodePtr, g_free); + static int loadData(const char *mapfile, xmlXPathContextPtr ctxt, @@ -39,20 +41,19 @@ loadData(const char *mapfile, cpuMapLoadCallback callback, void *data) { - int ret =3D -1; VIR_XPATH_NODE_AUTORESTORE(ctxt) - xmlNodePtr *nodes =3D NULL; + g_autoptr(xmlNodePtr) nodes =3D NULL; int n; size_t i; int rv; =20 if ((n =3D virXPathNodeSet(element, ctxt, &nodes)) < 0) - goto cleanup; + return -1; =20 if (n > 0 && !callback) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected element '%s' in CPU map '%s'"), eleme= nt, mapfile); - goto cleanup; + return -1; } =20 for (i =3D 0; i < n; i++) { @@ -60,22 +61,17 @@ loadData(const char *mapfile, if (!name) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find %s name in CPU map '%s'"), eleme= nt, mapfile); - goto cleanup; + return -1; } VIR_DEBUG("Load %s name %s", element, name); ctxt->node =3D nodes[i]; rv =3D callback(ctxt, name, data); VIR_FREE(name); if (rv < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - - cleanup: - VIR_FREE(nodes); - - return ret; + return 0; } =20 static int --=20 2.26.2 From nobody Mon Apr 29 07:32:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490771; cv=none; d=zohomail.com; s=zohoarc; b=HAjblqdTjGYjlutTAJaBppJOdKBLKWoNO0ILjk3dPR6VJdAkkAwnz1pGo82kfT44LUfFptKGwlBTkxw+KNySjMChHcrKX+Y1tOSohjR1mtUffAk4NFpHB7wIUkjHiS9T511JyoNR1xoVQoo8W9UOFC3oyCdPVBaL6OFI+YBfqdg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490771; 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=FBlJEJYGz92jseo51VKaUWWb/oAfk68TdQstAVIFt+I=; b=QmOGXl2Vg4NI+H7CXb7YS6I753ftinx2DgAEWt1LjUrhKpBk7AeFF+o3JzaW+WngH06xZ4iF827ZTTPUOaXXRSPeLW94kVNDRmAZmoSi3WxZpQ7qz6U4bcTVwzLXLc37eV8WZz9tQUlaL98sbcuLlRodq+uhHw684caocdVCnB0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1599490771742398.3133968371934; Mon, 7 Sep 2020 07:59:31 -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-275-52opAUk2Pgq4hDkTZVygIg-1; Mon, 07 Sep 2020 10:59:28 -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 C88081DDEC; Mon, 7 Sep 2020 14:59:22 +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 A63237D8AD; Mon, 7 Sep 2020 14:59:22 +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 6B0A618561B5; Mon, 7 Sep 2020 14:59:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExDbb030533 for ; Mon, 7 Sep 2020 10:59:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 61B1227BD1; Mon, 7 Sep 2020 14:59:13 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8EA01A8EC; Mon, 7 Sep 2020 14:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490770; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FBlJEJYGz92jseo51VKaUWWb/oAfk68TdQstAVIFt+I=; b=Map7srgypcOpV4Btv2ul4JLXgNMgLW7gJaqtFhkABWy34h4qzvxtzvHLJVO/2ddTLeJVyv HpdnEEJ2JkUgZtkvN8CKmw+kdEi3h61sDYGY1omsP3C/Gc6kj4qPze7v9smf+U6L7W131c jSL5OA3FhqyBJrqyg+/PgwcvA1bJYYA= X-MC-Unique: 52opAUk2Pgq4hDkTZVygIg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/15] cpu_map: Use g_auto* in cpuMapLoadInclude Date: Mon, 7 Sep 2020 16:58:53 +0200 Message-Id: <20200907145906.426709-3-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_map.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index c315ab32b2..1b73249649 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -81,10 +81,9 @@ cpuMapLoadInclude(const char *filename, cpuMapLoadCallback modelCB, void *data) { - xmlDocPtr xml =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; - int ret =3D -1; - char *mapfile; + g_autoptr(xmlDoc) xml =3D NULL; + g_autoptr(xmlXPathContext) ctxt =3D NULL; + g_autofree char *mapfile =3D NULL; =20 if (!(mapfile =3D virFileFindResource(filename, abs_top_srcdir "/src/cpu_map", @@ -94,27 +93,20 @@ cpuMapLoadInclude(const char *filename, VIR_DEBUG("Loading CPU map include from %s", mapfile); =20 if (!(xml =3D virXMLParseFileCtxt(mapfile, &ctxt))) - goto cleanup; + return -1; =20 ctxt->node =3D xmlDocGetRootElement(xml); =20 if (loadData(mapfile, ctxt, "vendor", vendorCB, data) < 0) - goto cleanup; + return -1; =20 if (loadData(mapfile, ctxt, "feature", featureCB, data) < 0) - goto cleanup; + return -1; =20 if (loadData(mapfile, ctxt, "model", modelCB, data) < 0) - goto cleanup; - - ret =3D 0; - - cleanup: - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xml); - VIR_FREE(mapfile); + return -1; =20 - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Mon Apr 29 07:32:59 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490774; cv=none; d=zohomail.com; s=zohoarc; b=hawFGwyDwbHQRqoJeYDhnwsS7oh8mXanstdhWJ0Kfl6q9E+lXdtJMN24wtp45lqQ9Tl+sEvhgLdlALh48bA0z9yEJMl/SUxHD8sHhYsMvUhs+KXcTjT3+rZnMgahYiArriPC/SxVZfskWYfjQzM7XYkWd+YVk76UZDo+cYhdtXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490774; 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=8irg8CuWnCUR5BrV/1wKNLANC6s612YemMnLEpFz8Us=; b=R4iEJZbZF5EMnlQCJK200BlHdfkHJtB7RA6gU6ysk/ORXlC+ZnoNmLRpXQvyoWG5yytcFcqPHJoRLC/KKjiN3mLuBxbsWUScOZODpGzu02dedW98YwV6wlT81mP4itatTY4xLUCRiTFqV4n9lhtA2yTaiv1xx3EWFvjkRv1xgJU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1599490774014207.57673839351082; Mon, 7 Sep 2020 07:59:34 -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-uMW_o3fvMf6_x8so_jCs6Q-1; Mon, 07 Sep 2020 10:59:29 -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 5B2E01084C99; Mon, 7 Sep 2020 14:59: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 3CC657D8AD; Mon, 7 Sep 2020 14:59:22 +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 0C28479FEE; Mon, 7 Sep 2020 14:59:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExEfA030542 for ; Mon, 7 Sep 2020 10:59:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 85D5227BD2; Mon, 7 Sep 2020 14:59:14 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6C511A8EC; Mon, 7 Sep 2020 14:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490772; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8irg8CuWnCUR5BrV/1wKNLANC6s612YemMnLEpFz8Us=; b=arss8oXfaIu61/AvZK/FM5jCTsKNeiyKm6j4igjMEOyktrZTm2pfShJqYnC9fH16/9ZbD4 kVkti30B8ntGgDca9qolYSRbqyPSdXQTuW3iEA6wnaOkUbM+4Rfl1iPCLOt7FnW8S4rgCL bTu8nVpKbv0t8Cn/axo+l8qDwrAJ2NU= X-MC-Unique: uMW_o3fvMf6_x8so_jCs6Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/15] cpu_map: Use g_auto* in loadIncludes Date: Mon, 7 Sep 2020 16:58:54 +0200 Message-Id: <20200907145906.426709-4-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_map.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index 1b73249649..372c00a1cd 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -117,37 +117,31 @@ loadIncludes(xmlXPathContextPtr ctxt, cpuMapLoadCallback modelCB, void *data) { - int ret =3D -1; VIR_XPATH_NODE_AUTORESTORE(ctxt) - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; int n; size_t i; =20 n =3D virXPathNodeSet("include", ctxt, &nodes); if (n < 0) - goto cleanup; + return -1; =20 for (i =3D 0; i < n; i++) { char *filename =3D virXMLPropString(nodes[i], "filename"); if (!filename) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing 'filename' in CPU map include")); - goto cleanup; + return -1; } VIR_DEBUG("Finding CPU map include '%s'", filename); if (cpuMapLoadInclude(filename, vendorCB, featureCB, modelCB, data= ) < 0) { VIR_FREE(filename); - goto cleanup; + return -1; } VIR_FREE(filename); } =20 - ret =3D 0; - - cleanup: - VIR_FREE(nodes); - - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Mon Apr 29 07:32:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490803; cv=none; d=zohomail.com; s=zohoarc; b=Ae2y+tyL0D4uzuuceBGy+pYWkF5tgrHyn621dPUlOL2o6IYRgcl577X2h1QdIoXJGc0NfmyhZQ/tHO+KnJVKq9Lg/MKrFYNSbQvh89KwVmML7HUtdYGn/XiVWIuMkFHtyVCsqIsl2fo3V/QTB07q1FSpK1nD2Y402hnem1PifMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490803; 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=IJPHT9bA8gVTrvI78Q4sdAhNIZEcp/986sV8s9P6rf8=; b=Cl7X76gis+LuK5+tQu3SS85O+jMHk3FvlkXFsWJPMrinSzQftgOkaNmO5berdlLJlUP6JRLiYBxnBCppf4Yo/EOqQBX2QAUD1O0BywEgw3jPo/nm3AuimQZk8P4DhsPUFsL4RwMSbGqbcKYsTYAMyWwaFAK+9IevPc/XY7Vn+LA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1599490803788977.6235650826152; Mon, 7 Sep 2020 08:00:03 -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-270-lwdnLBNeOHG3s9vLP08niA-1; Mon, 07 Sep 2020 10:59:32 -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 7ED2A1005E73; Mon, 7 Sep 2020 14:59: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 5C4D7100238E; Mon, 7 Sep 2020 14:59: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 2526718561B9; Mon, 7 Sep 2020 14:59:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExFdR030552 for ; Mon, 7 Sep 2020 10:59:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96F9A27BD1; Mon, 7 Sep 2020 14:59:15 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9AAA1A8EC; Mon, 7 Sep 2020 14:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490802; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IJPHT9bA8gVTrvI78Q4sdAhNIZEcp/986sV8s9P6rf8=; b=TDYOzCc+NcnZT1hnfvNvHukn3yTQnsYxayBt0C/L1ckmeeY6wHHFLxFWk5Sgwn8UOusYOs a3pfD2eNriS52flZU7rrXKwvHlNpmnwpZVreR/nWkGySVpJt+9SdEYYzhtrXGzLSVSXfN+ QIb+ygWPEvyfXyZ+eeJHG4fnETTRzAE= X-MC-Unique: lwdnLBNeOHG3s9vLP08niA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/15] cpu: Use g_auto* in virCPUCompareXML Date: Mon, 7 Sep 2020 16:58:55 +0200 Message-Id: <20200907145906.426709-5-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index d502c02f51..a84eb10cc4 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -111,21 +111,15 @@ virCPUCompareXML(virArch arch, const char *xml, bool failIncompatible) { - virCPUDefPtr cpu =3D NULL; - virCPUCompareResult ret =3D VIR_CPU_COMPARE_ERROR; + g_autoptr(virCPUDef) cpu =3D NULL; =20 VIR_DEBUG("arch=3D%s, host=3D%p, xml=3D%s", virArchToString(arch), host, NULLSTR(xml)); =20 if (virCPUDefParseXMLString(xml, VIR_CPU_TYPE_AUTO, &cpu) < 0) - goto cleanup; - - ret =3D virCPUCompare(arch, host, cpu, failIncompatible); - - cleanup: - virCPUDefFree(cpu); + return VIR_CPU_COMPARE_ERROR; =20 - return ret; + return virCPUCompare(arch, host, cpu, failIncompatible); } =20 =20 --=20 2.26.2 From nobody Mon Apr 29 07:32:59 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490779; cv=none; d=zohomail.com; s=zohoarc; b=ZU8+ruELPRcgX72e0Sl3i/rSKzgrRqo2sbP0W28zCYbi7197PoOBOVuwhdq7Xznw9Z9QqiEjvGVfog9pQVm1kSrv0NEnVYL76SoAahJLR+yAVdXOmNBg6aNGi02dHDM9FzxcFhc7M0xTVVYrAvx/FQvUD2w1lV1zt1h5dpwv7G8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490779; 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=eh+myYDpqjNu1zzAuFLNBC2OZ2PSTwUFnB3e6phW/Gg=; b=M1fXBUAi+OUKnNVz6wSL+l485un3FEJrj2yq3s4k17kMLRRXT2w+YMIYGyiNsJw4+037+oAZHec3vrT8EPPs1C2n1N3HWpW5MOp22HbbwzhOeYdkDCdE6X8nTRlsTbWRGzLm50HyXsteNlJcJn/m+UUgBVZOzm41BDmoWwxN0fs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599490779235895.3980487691935; Mon, 7 Sep 2020 07:59:39 -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-358-iNmY95DeO7aikobgXTk-TQ-1; Mon, 07 Sep 2020 10:59:35 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0A8E718B9EEA; Mon, 7 Sep 2020 14:59:29 +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 D923C5C26C; Mon, 7 Sep 2020 14:59:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8A0E779FF2; Mon, 7 Sep 2020 14:59:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExG37030573 for ; Mon, 7 Sep 2020 10:59:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id AEB5927BDD; Mon, 7 Sep 2020 14:59:16 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAD9A27BDC; Mon, 7 Sep 2020 14:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490778; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eh+myYDpqjNu1zzAuFLNBC2OZ2PSTwUFnB3e6phW/Gg=; b=JcKNJSQ4R53yyuO/Mu2uoKucjB6wftV98kd6azIlNST1SEt9dlDBBc0N5Ea7/rD3l/SZVX HfPRAWZmI6XySwASHYzIyugkNVU8NvqSVsMfi7OHy7d11I0Pc6HxBFBC+Sc/DqSZ797ayv fIUDQ7lgmGmcJYq7HiAie08AC60182Q= X-MC-Unique: iNmY95DeO7aikobgXTk-TQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/15] cpu: Use g_auto* in virCPUGetHost Date: Mon, 7 Sep 2020 16:58:56 +0200 Message-Id: <20200907145906.426709-6-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index a84eb10cc4..69e4205e4b 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -378,7 +378,7 @@ virCPUGetHost(virArch arch, virDomainCapsCPUModelsPtr models) { struct cpuArchDriver *driver; - virCPUDefPtr cpu =3D NULL; + g_autoptr(virCPUDef) cpu =3D NULL; =20 VIR_DEBUG("arch=3D%s, type=3D%s, nodeInfo=3D%p, models=3D%p", virArchToString(arch), virCPUTypeToString(type), nodeInfo, @@ -400,7 +400,7 @@ virCPUGetHost(virArch arch, virReportError(VIR_ERR_INVALID_ARG, _("cannot set topology for CPU type '%s'"), virCPUTypeToString(type)); - goto error; + return NULL; } cpu->type =3D type; break; @@ -410,7 +410,7 @@ virCPUGetHost(virArch arch, virReportError(VIR_ERR_INVALID_ARG, _("unsupported CPU type: %s"), virCPUTypeToString(type)); - goto error; + return NULL; } =20 if (nodeInfo) { @@ -424,9 +424,8 @@ virCPUGetHost(virArch arch, * filled in. */ if (driver->getHost) { - if (driver->getHost(cpu, models) < 0 && - !nodeInfo) - goto error; + if (driver->getHost(cpu, models) < 0 && !nodeInfo) + return NULL; } else if (nodeInfo) { VIR_DEBUG("cannot detect host CPU model for %s architecture", virArchToString(arch)); @@ -434,14 +433,10 @@ virCPUGetHost(virArch arch, virReportError(VIR_ERR_NO_SUPPORT, _("cannot detect host CPU model for %s architecture= "), virArchToString(arch)); - goto error; + return NULL; } =20 - return cpu; - - error: - virCPUDefFree(cpu); - return NULL; + return g_steal_pointer(&cpu); } =20 =20 --=20 2.26.2 From nobody Mon Apr 29 07:32:59 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490773; cv=none; d=zohomail.com; s=zohoarc; b=df5AOkofbDtYmW0+3E5bJYz3I+PA+t8W+dlzN9bKXKJKXbSpGYkdJvtv34W4hVkxaEiSvzny4p+KGoXoAsQMB03UNQAWBnyWASNdocOgW4hazHC5aVo7kZqnyXT5Tvf4phVUI6mE2QX75EsRgdSXwH2SAdYpO0ux9lK5lJKBq84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490773; 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=liIaY+QG2gg0DYbfFTs4/fBwPUPQrT+C0N9acH5o6jA=; b=iTcey9XHWrZ/PMQ/NJuC/tHy02m+j9ayQutRKV8iWU0nPoelE5ot7P+IscdI03DzajChJOriqEsN7/jJaX3Qg7sUFTRq6sGHmcpLS9GdY14Qg7QKukWnzyTjtDzFTtqmBaguciVd2AVlqVyIEadFABXjpzlhqfpB4e2cQwPciBs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1599490773770705.2402508109672; Mon, 7 Sep 2020 07:59: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-154-oWI0ZWJJMyuLebxyVND0yQ-1; Mon, 07 Sep 2020 10:59:30 -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 C39DF1005E5F; Mon, 7 Sep 2020 14:59:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A19DD7C452; Mon, 7 Sep 2020 14:59: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 6FD9679FF0; Mon, 7 Sep 2020 14:59:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExH63030583 for ; Mon, 7 Sep 2020 10:59:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id B9F3527BDD; Mon, 7 Sep 2020 14:59:17 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E20627BDC; Mon, 7 Sep 2020 14:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490772; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=liIaY+QG2gg0DYbfFTs4/fBwPUPQrT+C0N9acH5o6jA=; b=JFVKuKv2cM7g5HUUZn0LucEutGShtv47pD6PAz1og5/VJZDtY+qrASHThTbyhV0mD4NdGh SzdvnPWujbeT7WpsB7N8lNGQCNZoMUgXe/VW57WIyOHLR0XJyeSbWdLVxpTI+oWTsZBGAz +8GhYCM+7w4ezHYuJ9D7i3lguT+UlKw= X-MC-Unique: oWI0ZWJJMyuLebxyVND0yQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/15] cpu_ppc64: Turn structs ppc64_{vendor, model, map} into typedefs Date: Mon, 7 Sep 2020 16:58:57 +0200 Message-Id: <20200907145906.426709-7-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This enables us to use g_auto* macros on those types. Signed-off-by: Tim Wiederhake --- src/cpu/cpu_ppc64.c | 91 +++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 41 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 5b34c00a18..c7860cb1b4 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -34,22 +34,31 @@ VIR_LOG_INIT("cpu.cpu_ppc64"); =20 static const virArch archs[] =3D { VIR_ARCH_PPC64, VIR_ARCH_PPC64LE }; =20 -struct ppc64_vendor { +typedef struct { char *name; -}; +} ppc64_vendor; + +static void ppc64VendorFree(ppc64_vendor *vendor); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(ppc64_vendor, ppc64VendorFree); =20 -struct ppc64_model { +typedef struct { char *name; - const struct ppc64_vendor *vendor; + const ppc64_vendor *vendor; virCPUppc64Data data; -}; +} ppc64_model; =20 -struct ppc64_map { +static void ppc64ModelFree(ppc64_model *model); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(ppc64_model, ppc64ModelFree); + +typedef struct { size_t nvendors; - struct ppc64_vendor **vendors; + ppc64_vendor **vendors; size_t nmodels; - struct ppc64_model **models; -}; + ppc64_model **models; +} ppc64_map; + +static void ppc64MapFree(ppc64_map *map); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(ppc64_map, ppc64MapFree); =20 /* Convert a legacy CPU definition by transforming * model names to generation names: @@ -142,7 +151,7 @@ ppc64DataCopy(virCPUppc64Data *dst, const virCPUppc64Da= ta *src) } =20 static void -ppc64VendorFree(struct ppc64_vendor *vendor) +ppc64VendorFree(ppc64_vendor *vendor) { if (!vendor) return; @@ -151,8 +160,8 @@ ppc64VendorFree(struct ppc64_vendor *vendor) VIR_FREE(vendor); } =20 -static struct ppc64_vendor * -ppc64VendorFind(const struct ppc64_map *map, +static ppc64_vendor * +ppc64VendorFind(const ppc64_map *map, const char *name) { size_t i; @@ -166,7 +175,7 @@ ppc64VendorFind(const struct ppc64_map *map, } =20 static void -ppc64ModelFree(struct ppc64_model *model) +ppc64ModelFree(ppc64_model *model) { if (!model) return; @@ -176,10 +185,10 @@ ppc64ModelFree(struct ppc64_model *model) VIR_FREE(model); } =20 -static struct ppc64_model * -ppc64ModelCopy(const struct ppc64_model *model) +static ppc64_model * +ppc64ModelCopy(const ppc64_model *model) { - struct ppc64_model *copy; + ppc64_model *copy; =20 if (VIR_ALLOC(copy) < 0) goto error; @@ -198,8 +207,8 @@ ppc64ModelCopy(const struct ppc64_model *model) return NULL; } =20 -static struct ppc64_model * -ppc64ModelFind(const struct ppc64_map *map, +static ppc64_model * +ppc64ModelFind(const ppc64_map *map, const char *name) { size_t i; @@ -212,15 +221,15 @@ ppc64ModelFind(const struct ppc64_map *map, return NULL; } =20 -static struct ppc64_model * -ppc64ModelFindPVR(const struct ppc64_map *map, +static ppc64_model * +ppc64ModelFindPVR(const ppc64_map *map, uint32_t pvr) { size_t i; size_t j; =20 for (i =3D 0; i < map->nmodels; i++) { - struct ppc64_model *model =3D map->models[i]; + ppc64_model *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; @@ -230,11 +239,11 @@ ppc64ModelFindPVR(const struct ppc64_map *map, return NULL; } =20 -static struct ppc64_model * +static ppc64_model * ppc64ModelFromCPU(const virCPUDef *cpu, - const struct ppc64_map *map) + const ppc64_map *map) { - struct ppc64_model *model; + ppc64_model *model; =20 if (!cpu->model) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -252,7 +261,7 @@ ppc64ModelFromCPU(const virCPUDef *cpu, } =20 static void -ppc64MapFree(struct ppc64_map *map) +ppc64MapFree(ppc64_map *map) { size_t i; =20 @@ -275,8 +284,8 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, const char *name, void *data) { - struct ppc64_map *map =3D data; - struct ppc64_vendor *vendor; + ppc64_map *map =3D data; + ppc64_vendor *vendor; int ret =3D -1; =20 if (VIR_ALLOC(vendor) < 0) @@ -306,8 +315,8 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, const char *name, void *data) { - struct ppc64_map *map =3D data; - struct ppc64_model *model; + ppc64_map *map =3D data; + ppc64_model *model; xmlNodePtr *nodes =3D NULL; char *vendor =3D NULL; unsigned long pvr; @@ -388,10 +397,10 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, } =20 =20 -static struct ppc64_map * +static ppc64_map * ppc64LoadMap(void) { - struct ppc64_map *map; + ppc64_map *map; =20 if (VIR_ALLOC(map) < 0) goto error; @@ -429,9 +438,9 @@ ppc64Compute(virCPUDefPtr host, virCPUDataPtr *guestData, char **message) { - struct ppc64_map *map =3D NULL; - struct ppc64_model *host_model =3D NULL; - struct ppc64_model *guest_model =3D NULL; + ppc64_map *map =3D NULL; + ppc64_model *host_model =3D NULL; + ppc64_model *guest_model =3D NULL; virCPUDefPtr cpu =3D NULL; virCPUCompareResult ret =3D VIR_CPU_COMPARE_ERROR; virArch arch; @@ -589,8 +598,8 @@ ppc64DriverDecode(virCPUDefPtr cpu, virDomainCapsCPUModelsPtr models) { int ret =3D -1; - struct ppc64_map *map; - const struct ppc64_model *model; + ppc64_map *map; + const ppc64_model *model; =20 if (!data || !(map =3D ppc64LoadMap())) return -1; @@ -689,9 +698,9 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, const char **features G_GNUC_UNUSED, bool migratable G_GNUC_UNUSED) { - struct ppc64_map *map; - const struct ppc64_model *model; - const struct ppc64_vendor *vendor =3D NULL; + ppc64_map *map; + const ppc64_model *model; + const ppc64_vendor *vendor =3D NULL; virCPUDefPtr cpu =3D NULL; size_t i; =20 @@ -705,7 +714,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, } =20 for (i =3D 0; i < ncpus; i++) { - const struct ppc64_vendor *vnd; + const ppc64_vendor *vnd; =20 /* Hosts running old (<=3D 1.2.18) versions of libvirt will report * strings like 'power7+' or 'power8e' instead of proper CPU model @@ -778,7 +787,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, static int virCPUppc64DriverGetModels(char ***models) { - struct ppc64_map *map; + ppc64_map *map; size_t i; int ret =3D -1; =20 --=20 2.26.2 From nobody Mon Apr 29 07:32:59 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599491117; cv=none; d=zohomail.com; s=zohoarc; b=nDnNg/k69c5v6nF1Hib+L9NNm8Ye2jdGaahOPtUnsdRGAtR9mtZQVTm+O1UXyahdv/uPvA930oRqX3GMCnwlXvUaTg2G+dTeAYbDHzDVzh4+cLIyMuUeGNzl2gC8vXzlvNRycMcq6QgL9nwM8EbGz+1OEd9m+HQd7cJ5kQo3Brk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599491117; 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=XIf4CMS48J+r8w6SeyNtu2orwVUgyfChll+g6Odpktg=; b=h+0mjN7DwahI86uTZvkxc/EJBFIf/SaJmWraEYqobmXLKW03il3ZMIKziz2wuWVgJXe/IZBSZQSsOE7iRDUa9r47J/o5flD3NCNntgRgoEnIlVMDdU55QVCx0l2JC9WfIk5vl7Bp5pMFdnEUtxmQmcVKiRqYmyPa88qOkAq47Bc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1599491117298854.8926143627043; Mon, 7 Sep 2020 08:05:17 -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-235-4BmZesUeMY-m-qTMSbIB1Q-1; Mon, 07 Sep 2020 10:59:33 -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 1F4001005E5B; Mon, 7 Sep 2020 14:59:28 +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 0B2A581195; Mon, 7 Sep 2020 14:59: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 C807418561BB; Mon, 7 Sep 2020 14:59:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExIEo030592 for ; Mon, 7 Sep 2020 10:59:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id CFF5B27C21; Mon, 7 Sep 2020 14:59:18 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1911127BDC; Mon, 7 Sep 2020 14:59:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490816; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XIf4CMS48J+r8w6SeyNtu2orwVUgyfChll+g6Odpktg=; b=NS0yPJjLUTQhJZCcQptW0EUsD++oVcwHe7yu5rbjM5iblFTt4hvTVB9v2fivzbEWqIpw8D xBBcggyGeZnVGw1tMA7b9cwjD/pVkcTtthX75Bzv0bWT8zsqF6Xd1pYHzChdPrjHRhG2RT 93dFivBX+43/dbEYdQgbOQqtK2s1VC4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599491116; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XIf4CMS48J+r8w6SeyNtu2orwVUgyfChll+g6Odpktg=; b=bO31Odl1+xwKTmYzHelLmpCk6fKtdRja2vMmibp5Tk17xRgR0+fYNrzQHVI+BWXiRWjOZl p6utp98sPkscp8waKAh6vmI6n8SonRbjqaqAM7Z+pNUqxO4Lxgb7ubVQ8lnYIveJc56C5A 58u3mF1hUDaugh6FRlAmCvQPliiCrsA= X-MC-Unique: 4BmZesUeMY-m-qTMSbIB1Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/15] cpu_ppc64: Use g_auto* in ppc64ModelCopy Date: Mon, 7 Sep 2020 16:58:58 +0200 Message-Id: <20200907145906.426709-8-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_ppc64.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index c7860cb1b4..9eaf9c6ae5 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -188,23 +188,19 @@ ppc64ModelFree(ppc64_model *model) static ppc64_model * ppc64ModelCopy(const ppc64_model *model) { - ppc64_model *copy; + g_autoptr(ppc64_model) 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 ppc64_model * --=20 2.26.2 From nobody Mon Apr 29 07:32:59 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490780; cv=none; d=zohomail.com; s=zohoarc; b=a/EXal3uUl9AN+wfUjG5MG7b/bjg9w8VHEMxmUoXzlMK7fyouPkHvLuibFfsjPY3AXxFJRTi4c/afDLbcuMJk2iSuOGcZVOTJfqdD5hS+4jDrTd3cmv6PZPoQpEti9bm1tZ1UQVseslVJiZFckj7m0d00OjH6kwnaByrfSoSjQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490780; 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=gIHbF4t8fY3h2BVWVENOUtvhwPROZHTdAWK/scMGIjg=; b=Q38KfFpSwWaCK0FhZrw6p/rKBgFWchLtSrm82ydIWbD+YngpPf9Q6nWKsMb5lvHtYf1cK8gCz2Uap/3zL09dPO7xwCH6m6ya7fC4hg4CVO6cSl2jYLVEbzuepl6H5QThAUkVSdDejT+GzvONj3PuAxpp5siQOhP9goXwpQKBBJs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1599490780514597.6971877818163; Mon, 7 Sep 2020 07:59:40 -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-456-ObqyBHSWOwWBsYkYbgvr9g-1; Mon, 07 Sep 2020 10:59:37 -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 62D041084C97; Mon, 7 Sep 2020 14:59:31 +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 427C97A1F3; Mon, 7 Sep 2020 14:59:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1243279FF6; Mon, 7 Sep 2020 14:59:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExJpu030601 for ; Mon, 7 Sep 2020 10:59:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id DE53527BDD; Mon, 7 Sep 2020 14:59:19 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F1BE27BDC; Mon, 7 Sep 2020 14:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490779; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gIHbF4t8fY3h2BVWVENOUtvhwPROZHTdAWK/scMGIjg=; b=Xic9OwrLhV1p5niInfTI+XEjh6FHohS4oIBuLOaiFkNpivPEwuBXvyP4AEHao1RkIl9czp jvSRbHqBKFEf8J1NISMKypOXV1KjpUz0vCXZEwTOzgqqolRF2co/dQOS7kdzDIAful9Tby QANgSFkChKZr601OupvIzudJRy9yvkQ= X-MC-Unique: ObqyBHSWOwWBsYkYbgvr9g-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/15] cpu_ppc64: Use g_auto* in ppc64VendorParse Date: Mon, 7 Sep 2020 16:58:59 +0200 Message-Id: <20200907145906.426709-9-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- 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 9eaf9c6ae5..81c3ce8319 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -281,8 +281,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, void *data) { ppc64_map *map =3D data; - ppc64_vendor *vendor; - int ret =3D -1; + g_autoptr(ppc64_vendor) vendor =3D NULL; =20 if (VIR_ALLOC(vendor) < 0) return -1; @@ -292,17 +291,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 Mon Apr 29 07:32:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490868; cv=none; d=zohomail.com; s=zohoarc; b=BSLl+XITM/5sIHT16v8ljJYj+iAUHWOsaxZmSUSyZxArVcb7/1G6s4oi4j1QnTH92qtZddyesZh5NG5+j7Rg5ipBTXquyF0I9u/Hv/sHdqm7rMyPBWuLXO8+a5uK2wYXjvk/khoW1/3T1A/Pa75iIEfPVoiOGtQlGClo8X6AbE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490868; 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=eHDbmE91IV4GnTZdsehr2xpHhSewSJS3nNNZq3RhpJU=; b=UmAMCP5aeaPyJ3b3bRU0kjjIPpHoYX6uNFfn01GzYsqkhOkIM4SvdOcuHGTUGnN/E35euYC8/OrNnrRI6P2DB0K6U35vNvLuvyN3mn3aUf7OX7J4QVV+wCbJYP35Bl8ody4SNVPakAyUI6Varjobiazx6vkD5Q4FjT+Vnwxl5Ls= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1599490868650479.1809416387449; Mon, 7 Sep 2020 08:01:08 -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-503-t9MDg9w1M2SW63H8zrrqEw-1; Mon, 07 Sep 2020 10:59:39 -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 08720807357; Mon, 7 Sep 2020 14:59:34 +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 D421F10023A7; Mon, 7 Sep 2020 14:59:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 99F3E185735E; Mon, 7 Sep 2020 14:59:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExLnh030622 for ; Mon, 7 Sep 2020 10:59:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id F3E2F27BDD; Mon, 7 Sep 2020 14:59:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4004127BDC; Mon, 7 Sep 2020 14:59:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490866; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eHDbmE91IV4GnTZdsehr2xpHhSewSJS3nNNZq3RhpJU=; b=YXI3p6UBDnpbSS461HiJlBcRa6KoFis21sFD71D7+mYAEuXZe8CQ+6Oc9w4aIgIE29XfE8 VaRuwlzmHzX8OCKzvSoVL3ZyHdu6r+gtYD12rUq6IgJvCxPO782mvapLIeqMypbbOL5HxP Nvm/VSdCFOhvxK3nX+2ZDyqr5JdD1FE= X-MC-Unique: t9MDg9w1M2SW63H8zrrqEw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/15] cpu_ppc64: Use g_auto* in ppc64ModelParse Date: Mon, 7 Sep 2020 16:59:00 +0200 Message-Id: <20200907145906.426709-10-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- 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 81c3ce8319..44420c9cd5 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -307,23 +307,22 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, void *data) { ppc64_map *map =3D data; - ppc64_model *model; - xmlNodePtr *nodes =3D NULL; - char *vendor =3D NULL; + g_autoptr(ppc64_model) model =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,21 +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: - ppc64ModelFree(model); - VIR_FREE(vendor); - VIR_FREE(nodes); - return ret; + return 0; } =20 =20 --=20 2.26.2 From nobody Mon Apr 29 07:32:59 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490775; cv=none; d=zohomail.com; s=zohoarc; b=ZpL9aVA5ogLhcj88ozI12dd/pWk+c+SHOokIYNz6CjCsz4pMoUqpaDCb8ou1Yf9kSretODFQ0VdF6FLZgTtz9R+oaNVPB3JIuX6nQSMcJt2G/kLvH6ts+5FZf/YLyscIy4OMn95QwVUtiumlAaYD1LHbK+FOLoBkmEHIRGPZlYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490775; 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=prNd0R/keOwCYmU8ItQ+qqQ90hRrpT3Shx+NJ2KXoHQ=; b=Ui87Lb8eWusAwGVHndh/qvPyXA9k/vRQ+tRtnXrkB+rXcURvMNMteMuuPNksvospriBCsy0ZB+bWnt53gobyUNbUJEFHHOeCbCkkwfSW/q0eDZkVfPqtzbeKe0cGK98X14+MvLElFgfD230SdiGvoJjwGgvkoaUv2LKumRuxZko= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1599490775591545.0634620620084; Mon, 7 Sep 2020 07:59:35 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-Or21wmXLPKu4CkuVcznfFA-1; Mon, 07 Sep 2020 10:59:32 -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 5E2E91005E64; Mon, 7 Sep 2020 14:59:26 +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 3D49E7C452; Mon, 7 Sep 2020 14:59:26 +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 0D19379FF1; Mon, 7 Sep 2020 14:59:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExMex030631 for ; Mon, 7 Sep 2020 10:59:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0E99927BDD; Mon, 7 Sep 2020 14:59:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5362E27C2A; Mon, 7 Sep 2020 14:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490774; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=prNd0R/keOwCYmU8ItQ+qqQ90hRrpT3Shx+NJ2KXoHQ=; b=Ha/YAhci4SqhH7vhu7U1ixOdZtDGEaJUxoWV8OMf/PoarozBaRWqmWGlneADR9qtIOj/LF AR+j61sjxOXz+8Bs08UkLxGGPro/2bnOEwPaoWe5WNBfrnotIYqMgm08loL6/csxZmJOLB 4fSaHpheGFPtIdBNk/qu1eAbeL59lbc= X-MC-Unique: Or21wmXLPKu4CkuVcznfFA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/15] cpu_ppc64: Use g_auto* in ppc64LoadMap Date: Mon, 7 Sep 2020 16:59:01 +0200 Message-Id: <20200907145906.426709-11-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_ppc64.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 44420c9cd5..7b34fe6bbc 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -384,19 +384,15 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, static ppc64_map * ppc64LoadMap(void) { - ppc64_map *map; + g_autoptr(ppc64_map) 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 --=20 2.26.2 From nobody Mon Apr 29 07:32:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599491238; cv=none; d=zohomail.com; s=zohoarc; b=fnJwlfXNhQunZ1ySoiFB5AjbyrZhvJ/E26AwdYt4aDba9117d+a84awwdIHPMhBLwll1Ur9EtFp2cWF0Vj0JXYBElK6gZ9FzOnBk+sTIE10jCVTMloyfeiMS65YoWSWI3tiqdjC6v0XbqJrYkeAdWYLUKqToIzGlGIP9+hW2+aM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599491238; 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=LSQpJfbpUq8mbAgVp0MKxVStsW6RXogvgvmSCdggHhc=; b=dvtV/+SpunZk+NDtk+qhp8orDwBw9sJouxtuzY6dIwDCvYnkdqNkdiGufMr7NzD1NVfWIRv5iMCNpUW+daPOMBxC9HXc0FGUR9Kl+dFqtwJWpbOX38fg3WABBtLGY0HtkaRD25WagIpNeUVQW3LpZPpoG7P+6DCMvMl7G2Lk07Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1599491238273451.60963554796933; Mon, 7 Sep 2020 08:07: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-423-7fa0b2etPPelv0k1S2KcqA-1; Mon, 07 Sep 2020 10:59:38 -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 90A4C8030A4; Mon, 7 Sep 2020 14:59:31 +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 6E4A15D9E8; Mon, 7 Sep 2020 14:59:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3CAB979FF7; Mon, 7 Sep 2020 14:59:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExNRB030650 for ; Mon, 7 Sep 2020 10:59:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2146A27BDD; Mon, 7 Sep 2020 14:59:23 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6657F27BDC; Mon, 7 Sep 2020 14:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490937; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LSQpJfbpUq8mbAgVp0MKxVStsW6RXogvgvmSCdggHhc=; b=IlXuCXYHPaHA30YmIa9WDSXseD9aS0xvPpb3yNgptGZ07rStnfEgnEXiUmd66IxjLtI9kK D/7Zi23rF2SOWQYZWACN5teSQOcp1TqRDfIICcCFnL4YHFtmWzXhbg4fFvf1GfN3cG/7EL 7WsXf5elTYFbwIAm/p8TTj//qWojPXs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599491237; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=LSQpJfbpUq8mbAgVp0MKxVStsW6RXogvgvmSCdggHhc=; b=aBrws9URNW/vmPi8yFDXqYhgNNQsRO7Ekly5lX2brcTl1ZNESkXN2NQkojyw/EysG6p6xM nBsvF4gDe7y8MMc5SJBahaShc9RitNpIDmlsDd814PETIlg4Qn4xeLaqv2Uarux9+cZ4YA YcAa9ONi4ly2SFdJfGXWjHzQrxh4Dq4= X-MC-Unique: 7fa0b2etPPelv0k1S2KcqA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 11/15] cpu_ppc64: Use g_auto* in ppc64Compute Date: Mon, 7 Sep 2020 16:59:02 +0200 Message-Id: <20200907145906.426709-12-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_ppc64.c | 46 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 7b34fe6bbc..aef1418872 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -418,18 +418,16 @@ ppc64Compute(virCPUDefPtr host, virCPUDataPtr *guestData, char **message) { - ppc64_map *map =3D NULL; - ppc64_model *host_model =3D NULL; - ppc64_model *guest_model =3D NULL; - virCPUDefPtr cpu =3D NULL; - virCPUCompareResult ret =3D VIR_CPU_COMPARE_ERROR; + g_autoptr(ppc64_map) map =3D NULL; + g_autoptr(ppc64_model) host_model =3D NULL; + g_autoptr(ppc64_model) guest_model =3D NULL; + 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; + if (!(cpu =3D virCPUDefCopy(other)) || virCPUppc64ConvertLegacy(cpu) <= 0) + return VIR_CPU_COMPARE_ERROR; =20 if (cpu->arch !=3D VIR_ARCH_NONE) { bool found =3D false; @@ -448,8 +446,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 +463,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 +481,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 +503,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,22 +514,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; - - ret =3D VIR_CPU_COMPARE_IDENTICAL; + return VIR_CPU_COMPARE_ERROR; =20 - cleanup: - virCPUDefFree(cpu); - ppc64MapFree(map); - ppc64ModelFree(host_model); - ppc64ModelFree(guest_model); - return ret; + return VIR_CPU_COMPARE_IDENTICAL; } =20 static virCPUCompareResult --=20 2.26.2 From nobody Mon Apr 29 07:32:59 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490780; cv=none; d=zohomail.com; s=zohoarc; b=n0YGez0v85Tgl1b4SurFQCligtv7zRcPZ5KO5cg+QQlKL7zP9kRwb2BMG8RLFYPix+qk/vfMG7a4x062GE6+84yRrOgxqQ6WeUuTuAHNEagn71fJ8/Z1i3QLGnbkGg8MrWBfKvSbsxepuzrtMicCLj75ru4V/RP82u4K121/8JY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490780; 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=xYWt1W5/2JO1kcqSoog/oC/a5NxGDBd03NWNXGV9JCQ=; b=QKB3GX2CimQ6G8HiwuEqQCWxrrJYFo33lhWc2H3C4s/cXQ9O390rgE1qqg+88kNQxrn4kRRMsGAIjMEapJrewxnSmLNAkVGHGhOJXSRz5lCcBZsdtUgL1i5ZfvKGhPT0BdSvyVh4Ega6PLvbu2skczVeRIJDzLUA8/8CMBDt4/M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1599490780207574.256842156725; Mon, 7 Sep 2020 07:59:40 -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-318-66bRXzpkOFyBAqQDtNXBcw-1; Mon, 07 Sep 2020 10:59:36 -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 D2C601005E77; Mon, 7 Sep 2020 14:59:28 +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 B395C805F1; Mon, 7 Sep 2020 14:59:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7C03B18561BF; Mon, 7 Sep 2020 14:59:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExOQe030658 for ; Mon, 7 Sep 2020 10:59:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2F0A727BDD; Mon, 7 Sep 2020 14:59:24 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75CF827C2A; Mon, 7 Sep 2020 14:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490779; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xYWt1W5/2JO1kcqSoog/oC/a5NxGDBd03NWNXGV9JCQ=; b=bYWpscKh4tP7s8FCN//3OjsyRn68PXNrBnqJDKwACd+NsOU7w2v/wz2X0Ejvf00WxTdcma /9JKNOJgaAmuIILTSFntEE0Qe/X+2yL6SwabmfHI/cS1+vGCT/oQO1pGbNGDDYSpJ0GOdY Gti8hUZDPI7PD1JMCnL2cXJRHeU/So0= X-MC-Unique: 66bRXzpkOFyBAqQDtNXBcw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 12/15] cpu_ppc64: Use g_auto* in ppc64DriverDecode Date: Mon, 7 Sep 2020 16:59:03 +0200 Message-Id: <20200907145906.426709-13-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_ppc64.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index aef1418872..d7ccd506fb 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -563,8 +563,7 @@ ppc64DriverDecode(virCPUDefPtr cpu, const virCPUData *data, virDomainCapsCPUModelsPtr models) { - int ret =3D -1; - ppc64_map *map; + g_autoptr(ppc64_map) map =3D NULL; const ppc64_model *model; =20 if (!data || !(map =3D ppc64LoadMap())) @@ -574,26 +573,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 --=20 2.26.2 From nobody Mon Apr 29 07:32:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490780; cv=none; d=zohomail.com; s=zohoarc; b=fP/cWexOpNgyTqL1IORu848eXkJdZWDAXTSt9FYPQUUljlXVBbR69kPqxNdpzMx529+5WFPjbeSEGs525RKTPVfvbqiva7XsgfMqvjQ6CNvgpOe6vD4BNePK5NOzDhuXxClI0sfanRHAXC48Bqtwjm5dp1R3yvszT2o5IwlbfwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490780; 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=ErEy9zxhNrc1koDlGfgXWizEqNXrUrqK+fQut/SlC1c=; b=J27WKlPsz90MYKb4cjFrB19NBXoB8h9vpgSPeHuLxYo+MkryOUNYSGHAEK58oOFEJSJliPJyMsDDBWURbjOvUwLBBYX0MvVx3ENNilfBA9vPytR525bHp6j+CXrsyr5F0iO+RicBxAn2GQ0RAaXshuzgVMkNXuJPT3hFAiYbfj8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1599490780846509.5913648304636; Mon, 7 Sep 2020 07:59:40 -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-382-ac7rDbVLNZqvUmmDWGK-_Q-1; Mon, 07 Sep 2020 10:59:37 -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 976561F1C0; Mon, 7 Sep 2020 14:59:31 +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 79F4681195; Mon, 7 Sep 2020 14:59:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4A9D779FFA; Mon, 7 Sep 2020 14:59:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExPNW030669 for ; Mon, 7 Sep 2020 10:59:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 44FB127BDC; Mon, 7 Sep 2020 14:59:25 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8594627C2A; Mon, 7 Sep 2020 14:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490779; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ErEy9zxhNrc1koDlGfgXWizEqNXrUrqK+fQut/SlC1c=; b=UTPhc43vezLN7NSRMWSawX1KZ5jnn6PXSsBv4XhcaTM+SVSGEi8SHC/NqV14ZCumOJLPq7 S3j8sfnmnJxJraByQ5Qm146J1AIQSSmlXmSL84QKFmriBMmzi+4jkKoCBBeQ636ycGcdP5 BcXxzrAcC4CF/76dGKwe9np2Zm9QVlM= X-MC-Unique: ac7rDbVLNZqvUmmDWGK-_Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 13/15] cpu_ppc64: Use g_auto* in virCPUppc64GetHost Date: Mon, 7 Sep 2020 16:59:04 +0200 Message-Id: <20200907145906.426709-14-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- 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 d7ccd506fb..30dd5a48c5 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -605,17 +605,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 @@ -625,11 +624,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 Mon Apr 29 07:32:59 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490787; cv=none; d=zohomail.com; s=zohoarc; b=IFul8H6jfWA19fQQK5utiRevQElPuPvyOYyn0iKJ+GEx3vzkAzwu2tgaiXliwn0YMUKqe8LsbeUUrstqHVPv9Q0dQ2lB9RjpCiZtLfmqPd3WqVg5nP+ZgEe7rip4ig9Z43dDXGefaLbThHbX6hMyiECujYIoAt+xfd96dFal9oc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490787; 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=7k36AEFKlPXa1io12dq1v5O+Dr8LnKag7l4KCzavAfI=; b=V7tuC/8DZVrX+f7booZbAjLvLSwQxBAjC8dRQhCwM9YaPsu7FklqHZZThjGIMO1yybcPwPN1+MHS8S0W8gt5RfBRfmgT/xWV3n746bAxG1IzEmxKu1hJKI6sRxGiQrZxTttaVMtedVdF5qdRDjIM7OAULHnByIewx9lBnmxwVuY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1599490787108392.09275659608306; Mon, 7 Sep 2020 07:59:47 -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-J69ehxI1M8acQ3kM-ZAHmg-1; Mon, 07 Sep 2020 10:59:41 -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 0574618B9EF3; Mon, 7 Sep 2020 14:59:34 +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 D40AD86584; Mon, 7 Sep 2020 14:59:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 99ACB185735C; Mon, 7 Sep 2020 14:59:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExQSX030678 for ; Mon, 7 Sep 2020 10:59:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 665BB27BDD; Mon, 7 Sep 2020 14:59:26 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2DDB27BDC; Mon, 7 Sep 2020 14:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490785; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=7k36AEFKlPXa1io12dq1v5O+Dr8LnKag7l4KCzavAfI=; b=ZqQ7MtJVtcZH1faAUCtCaQGDDX+/PSm70QpZ+T9yMK53+sN3zlQhmQBfs7I8rByGG9SZXE EvoswiNs/2wl6Xb4hWEk7I51CwFgEHhBZyHnu+Otp8KLAQXaPOkgUyn6EQZNBsK8J9FA3X J38erBzUVBxuq+4O13bxmYBAMWEdGBI= X-MC-Unique: J69ehxI1M8acQ3kM-ZAHmg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 14/15] cpu_ppc64: Use g_auto* in virCPUppc64Baseline Date: Mon, 7 Sep 2020 16:59:05 +0200 Message-Id: <20200907145906.426709-15-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_ppc64.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 30dd5a48c5..db59f5adbf 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -653,19 +653,19 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, const char **features G_GNUC_UNUSED, bool migratable G_GNUC_UNUSED) { - ppc64_map *map; + g_autoptr(ppc64_map) map =3D NULL; const ppc64_model *model; const ppc64_vendor *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++) { @@ -685,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) @@ -694,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) { @@ -704,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; @@ -728,15 +728,7 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, cpu->match =3D VIR_CPU_MATCH_EXACT; cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; =20 - cleanup: - ppc64MapFree(map); - - return cpu; - - error: - virCPUDefFree(cpu); - cpu =3D NULL; - goto cleanup; + return g_steal_pointer(&cpu); } =20 static int --=20 2.26.2 From nobody Mon Apr 29 07:32:59 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599490784; cv=none; d=zohomail.com; s=zohoarc; b=ZtvyLj3wkxKdinThmXFg+2VJRTUCb3FaRUYVV8awaTqzCM+A4FF+t+yWzZK2ao+Yok4uEsfKt+UNnmIzNiRVXrsTbD5EZEZrMt7ss//KQV4tLeMRetWHVbe3a9F1ci4ahM/wXNvzPYFys5U1fsCEFM8v5bXoiti+Jx2MN7QtvBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599490784; 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=ESGWMscllZ6LlTmGqG6SGRfsmLY2MvejjBlIkHVNZQc=; b=etYfHIbAj3mnbCtuG0IRk14Vo8ygdgcvDvJrXcxBIj8r1MWMDHySlAYvfUenLfjQvb9NpWHegvE9j0VzJAVYXmHU3jqViUe1HWBraCXda3AvHloEGjAaq72OzBxWnpBfdPTP3en4zETW6PeLb9QZCvfccEFXlfSAqvCxHtkYLiI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass 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 1599490784041287.2298878889509; Mon, 7 Sep 2020 07:59:44 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-538-dDiLnig1MyK72ElP6yOzEg-1; Mon, 07 Sep 2020 10:59:40 -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 2B4548030C4; Mon, 7 Sep 2020 14:59:34 +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 06F7C100238E; Mon, 7 Sep 2020 14:59:34 +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 C045F185735B; Mon, 7 Sep 2020 14:59:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087ExU7V030716 for ; Mon, 7 Sep 2020 10:59:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6950327C2A; Mon, 7 Sep 2020 14:59:30 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id A690127BDD; Mon, 7 Sep 2020 14:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599490782; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ESGWMscllZ6LlTmGqG6SGRfsmLY2MvejjBlIkHVNZQc=; b=CfhDer7tjJASw+qlL9TBnViWZtJ2tvNQoZZ7dnXpH9wnKLGDUyU9S2BSEWJBfr/s7wdLQ6 Ujn0UQTSY3Ac0wHCg/2WcMLwJSKvdOsOXGExz707PI66Fas784u/VX3mh/Y5Gn/DmWx0M9 gioxfZ0xd3I0Et/EI9CIdecUO+F40Bo= X-MC-Unique: dDiLnig1MyK72ElP6yOzEg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 15/15] cpu_ppc64: Use g_auto* in virCPUppc64DriverGetModels Date: Mon, 7 Sep 2020 16:59:06 +0200 Message-Id: <20200907145906.426709-16-twiederh@redhat.com> In-Reply-To: <20200907145906.426709-1-twiederh@redhat.com> References: <20200907145906.426709-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_ppc64.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index db59f5adbf..860e959900 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -734,33 +734,21 @@ virCPUppc64Baseline(virCPUDefPtr *cpus, static int virCPUppc64DriverGetModels(char ***models) { - ppc64_map *map; + g_autoptr(ppc64_map) map =3D NULL; size_t i; - int ret =3D -1; =20 if (!(map =3D ppc64LoadMap())) - goto error; + return -1; =20 if (models) { if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0) - goto error; + return -1; =20 for (i =3D 0; i < map->nmodels; i++) (*models)[i] =3D g_strdup(map->models[i]->name); } =20 - ret =3D map->nmodels; - - cleanup: - ppc64MapFree(map); - return ret; - - error: - if (models) { - g_strfreev(*models); - *models =3D NULL; - } - goto cleanup; + return map->nmodels; } =20 struct cpuArchDriver cpuDriverPPC64 =3D { --=20 2.26.2