From nobody Sun Feb 8 12:14:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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=1585316687; cv=none; d=zohomail.com; s=zohoarc; b=a9kRTyhSs3O/IA6Xe5qMpeGfSna80QSajU/PfTRPMpdFHWdl7YM79FBGJbteq8jTMWW4var4Cqy1/UcFhmGWLW7r/cUy7MDwO3bgxxpWITIrne0/vAHtQWFzcwLlizinj4Pvo3zhdeKMc5TvWl36J+AqB8itQa2zNibtl2AwPzI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585316687; h=Content-Type:Content-Transfer-Encoding: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=ewUbTkP55IFI/4ugFSy0BXKJaXmSAhwFeBwg9pdcTKE=; b=ImjewjqiBGIObg5W7ZdbJLGM7TRmknMy3Ffh0h+BVdKnkPErKk4CEGQZVW0IOVg9UNWRxtaVvuRmzAZzQzw61wCvNJb0bOs46GiFgvDqTyuu/U01+7j4wwkTfmyWOgNN4SKwTMnwnHe9HR7vzP1IoxtAd4SbHrztwEJMcjIKC3o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 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-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1585316687649108.64176167390144; Fri, 27 Mar 2020 06:44: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-159-Uu2TKSEnPrmr2Ko6M_a1FQ-1; Fri, 27 Mar 2020 09:44:41 -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 D91D41005516; Fri, 27 Mar 2020 13:44:35 +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 A54865E038; Fri, 27 Mar 2020 13:44:35 +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 5EA9D18089D0; Fri, 27 Mar 2020 13:44:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02RDiKvU006292 for ; Fri, 27 Mar 2020 09:44:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D8345C1D6; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: from rein.int.mamuti.net (unknown [10.40.192.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D6645C1D4 for ; Fri, 27 Mar 2020 13:44:20 +0000 (UTC) Received: by rein.int.mamuti.net (Postfix, from userid 500) id CEA5818D071; Fri, 27 Mar 2020 14:44:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585316683; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=ewUbTkP55IFI/4ugFSy0BXKJaXmSAhwFeBwg9pdcTKE=; b=YBDXZzMfE8SlqJQw09l2ntrBvJpR/aA1KDZFNkNJ5V0VPf67FdS53tez6zOyxyyrmcKqHr xl99HqvOYT5UdGt3OnYkBc0K6vWeIjlsS13vHLRZuSavm0x+hL97u+jgyyyuI8vVFZ0VTd uYu36yhUGyR5U4DYcLXll4uHN48t9Hk= X-MC-Unique: Uu2TKSEnPrmr2Ko6M_a1FQ-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 05/39] cpu_x86: Use glib allocation for virCPUx86Model Date: Fri, 27 Mar 2020 14:43:34 +0100 Message-Id: <281aa0eea858efd398a93a1ea692c9d8e3fea55f.1585316580.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 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: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_x86.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index cfb8a2e4a5..4a0413db16 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -1111,29 +1111,18 @@ x86FeatureParse(xmlXPathContextPtr ctxt, } =20 =20 -static virCPUx86ModelPtr -x86ModelNew(void) -{ - virCPUx86ModelPtr model; - - if (VIR_ALLOC(model) < 0) - return NULL; - - return model; -} - - static void x86ModelFree(virCPUx86ModelPtr model) { if (!model) return; =20 - VIR_FREE(model->name); - VIR_FREE(model->signatures); + g_free(model->name); + g_free(model->signatures); virCPUx86DataClear(&model->data); - VIR_FREE(model); + g_free(model); } +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUx86Model, x86ModelFree); =20 =20 static int @@ -1161,9 +1150,7 @@ x86ModelCopy(virCPUx86ModelPtr model) { virCPUx86ModelPtr copy; =20 - if (VIR_ALLOC(copy) < 0) - return NULL; - + copy =3D g_new0(virCPUx86Model, 1); copy->name =3D g_strdup(model->name); =20 if (x86ModelCopySignatures(copy, model) < 0) { @@ -1216,7 +1203,7 @@ x86ModelFromCPU(const virCPUDef *cpu, if (cpu->type =3D=3D VIR_CPU_TYPE_HOST && policy !=3D VIR_CPU_FEATURE_REQUIRE && policy !=3D -1) - return x86ModelNew(); + return g_new0(virCPUx86Model, 1); =20 if (cpu->model && (policy =3D=3D VIR_CPU_FEATURE_REQUIRE || policy =3D=3D -1)) { @@ -1228,7 +1215,7 @@ x86ModelFromCPU(const virCPUDef *cpu, =20 model =3D x86ModelCopy(model); } else { - model =3D x86ModelNew(); + model =3D g_new0(virCPUx86Model, 1); } =20 if (!model) @@ -1540,9 +1527,7 @@ x86ModelParse(xmlXPathContextPtr ctxt, goto cleanup; } =20 - if (!(model =3D x86ModelNew())) - goto cleanup; - + model =3D g_new0(virCPUx86Model, 1); model->name =3D g_strdup(name); =20 if (x86ModelParseDecode(model, ctxt) < 0) --=20 2.26.0