From nobody Fri Dec 19 04:01:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1571153751; cv=none; d=zoho.com; s=zohoarc; b=Bp7aKGwXL9D5EqhDFW6sTkwLW/kwKBB5WWetMPJm68NhqscEjx3MGfelTmSJt3ipehsulA4MOsHRru9UkXMIcPdMH+4aomO9diAnPIaO9jp5S2ugPCh9r+89fPTqD2sYowlIvA5osoFnM3+KYj0VJTkNcD0Ov5XLjJdV27J28aw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571153751; 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=srePd1gTDaTNAOeazzQLjOEn9zsfCrYMdDczbq5PRbM=; b=nUqHpOleGezGwmMIHLYOXjqa/L++g34LmtbsHnq4/eH46avlBxzGjCdcnQaxqfV5Ie1EvXJj/G1EAFYSwmN+lwMqqSfrZwxEV9p/qvLAqVnYgSuoHAeF811oYNDitNIj80rNUY6UbqbnAuFs8ovd9JGIdhHZxleLvvSioLflZnI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 157115375168036.69011473617718; Tue, 15 Oct 2019 08:35:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9D6D10CC202; Tue, 15 Oct 2019 15:35:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 812E33CC8; Tue, 15 Oct 2019 15:35:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3BFBB180BAA1; Tue, 15 Oct 2019 15:35:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9FFZGKe024681 for ; Tue, 15 Oct 2019 11:35:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9067E5D6B0; Tue, 15 Oct 2019 15:35:16 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6564D5D6A9 for ; Tue, 15 Oct 2019 15:35:16 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 9810F101CE1; Tue, 15 Oct 2019 17:35:09 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 15 Oct 2019 17:34:56 +0200 Message-Id: <609a80f179afe07001e065e1eec2bb2e88c5fb02.1571152057.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 20/31] conf: Drop virDomainCapsCPUModelsAddSteal 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Tue, 15 Oct 2019 15:35:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Both virDomainCapsCPUModelsAdd and virDomainCapsCPUModelsAddSteal are so simple we can just squash the code in a single function. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change src/conf/domain_capabilities.c | 33 ++++++++++----------------------- src/conf/domain_capabilities.h | 4 ---- src/libvirt_private.syms | 1 - 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index a13463a6e7..dadb2a1183 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -185,27 +185,6 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr o= ld) } =20 =20 -int -virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels, - char **name, - virDomainCapsCPUUsable usable, - char ***blockers) -{ - if (VIR_RESIZE_N(cpuModels->models, cpuModels->nmodels_max, - cpuModels->nmodels, 1) < 0) - return -1; - - cpuModels->models[cpuModels->nmodels].usable =3D usable; - VIR_STEAL_PTR(cpuModels->models[cpuModels->nmodels].name, *name); - - if (blockers) - VIR_STEAL_PTR(cpuModels->models[cpuModels->nmodels].blockers, *blo= ckers); - - cpuModels->nmodels++; - return 0; -} - - int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels, const char *name, @@ -214,6 +193,7 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpu= Models, { VIR_AUTOFREE(char *) nameCopy =3D NULL; VIR_AUTOSTRINGLIST blockersCopy =3D NULL; + virDomainCapsCPUModelPtr cpu; =20 if (VIR_STRDUP(nameCopy, name) < 0) return -1; @@ -221,10 +201,17 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr c= puModels, if (virStringListCopy(&blockersCopy, (const char **)blockers) < 0) return -1; =20 - if (virDomainCapsCPUModelsAddSteal(cpuModels, &nameCopy, - usable, &blockersCopy) < 0) + if (VIR_RESIZE_N(cpuModels->models, cpuModels->nmodels_max, + cpuModels->nmodels, 1) < 0) return -1; =20 + cpu =3D cpuModels->models + cpuModels->nmodels; + cpuModels->nmodels++; + + cpu->usable =3D usable; + VIR_STEAL_PTR(cpu->name, nameCopy); + VIR_STEAL_PTR(cpu->blockers, blockersCopy); + return 0; } =20 diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index bdd0bd9253..8b220e3bf8 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -195,10 +195,6 @@ virDomainCapsPtr virDomainCapsNew(const char *path, =20 virDomainCapsCPUModelsPtr virDomainCapsCPUModelsNew(size_t nmodels); virDomainCapsCPUModelsPtr virDomainCapsCPUModelsCopy(virDomainCapsCPUModel= sPtr old); -int virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels, - char **name, - virDomainCapsCPUUsable usable, - char ***blockers); int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels, const char *name, virDomainCapsCPUUsable usable, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 641b1f93bd..b35934be1f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -191,7 +191,6 @@ virDomainAuditVcpu; =20 # conf/domain_capabilities.h virDomainCapsCPUModelsAdd; -virDomainCapsCPUModelsAddSteal; virDomainCapsCPUModelsCopy; virDomainCapsCPUModelsGet; virDomainCapsCPUModelsNew; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list