From nobody Mon Apr 29 13:57:49 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=1601917387; cv=none; d=zohomail.com; s=zohoarc; b=RIvjMBGoJsUaXI7dgTm9Ho6TgbeRR95HaActVPn3Kum7DFgnnmKBd4WBY9zLE3fM8281OztKA3Rd0VuNC5tuo4xZDCU5MUmkpzsBOga85jxdjOFZD4LzwYA75L9lh8MSsLfVG5iPs8xwk1DvFpuOO99xn8TetvBa6MDJUQh2OMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601917387; 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=fSI6d1O9tzk9lfGZ+no/CzvqMhdbKyeZOwFvJp+h3i0=; b=XtLjzg2DI/aIEFv2WKBxpEu9RNsOlEcXqqXZ4srxmEEKdGAzlgeKmtFi/uaLbqjnjbfFZ9bGsKSwDgOVFMhVJJk13aFvL1dKlXFlhwt27DAJ3r5f3wClyUuj/R8N532Zbgo37HnB3CVc2x6GJfGfj7bApyvQUa+RopIr1LGXj3E= 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 16019173871575.374370967467598; Mon, 5 Oct 2020 10:03:07 -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-592-zsplSPMBOju3k-MYYFxcuA-1; Mon, 05 Oct 2020 13:03:03 -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 7AA7E107ACF9; Mon, 5 Oct 2020 17:02:57 +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 491DD55764; Mon, 5 Oct 2020 17:02:57 +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 115CF44A69; Mon, 5 Oct 2020 17:02:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 095H2noG009764 for ; Mon, 5 Oct 2020 13:02:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3539673666; Mon, 5 Oct 2020 17:02:49 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFF4D73679 for ; Mon, 5 Oct 2020 17:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601917385; 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=fSI6d1O9tzk9lfGZ+no/CzvqMhdbKyeZOwFvJp+h3i0=; b=Ba4wDr1UzCqJJnzulHPb8Kta5S1ylZK+Ea5kK1Q0sbjs8CwBvWLlsKJcNBI36VDP1vaQVs 5YNRvQHDZd1Pzn0Q5H8BrzMm15CxS9l/ONmaWJDWAWrQxGjBSa9pD1RoghtSeDeEGP/lH0 bdOi3yghbVIXZnmQmPA9MHCefr8HHxE= X-MC-Unique: zsplSPMBOju3k-MYYFxcuA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] virsh: do not add bools into size calculations Date: Mon, 5 Oct 2020 19:02:36 +0200 Message-Id: <137457f6b729c16faa07b3bfbe7dc4a3522b2b8c.1601917336.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Switch the allocation in virshSnapshotListCollect and its cargo-culted Checkpoint counterpart to two separate g_new0 calls and move the boolean expression to the if condition that chooses between them. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Erik Skultety --- tools/virsh-checkpoint.c | 6 ++++-- tools/virsh-snapshot.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index f3c4fe90ba..cefdfd7800 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -600,8 +600,10 @@ virshCheckpointListCollect(vshControl *ctl, =20 /* When mixing --from and --tree, we also want a copy of from * in the list, but with no parent for that one entry. */ - checkpointlist->chks =3D vshCalloc(ctl, count + (tree && from), - sizeof(*checkpointlist->chks)); + if (from && tree) + checkpointlist->chks =3D g_new0(struct virshChk, count + 1); + else + checkpointlist->chks =3D g_new0(struct virshChk, count); checkpointlist->nchks =3D count; for (i =3D 0; i < count; i++) checkpointlist->chks[i].chk =3D chks[i]; diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 99e3d98c6f..b4498df298 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1102,8 +1102,10 @@ virshSnapshotListCollect(vshControl *ctl, virDomainP= tr dom, if (count >=3D 0) { /* When mixing --from and --tree, we also want a copy of from * in the list, but with no parent for that one entry. */ - snaplist->snaps =3D vshCalloc(ctl, count + (tree && from), - sizeof(*snaplist->snaps)); + if (tree && from) + snaplist->snaps =3D g_new0(struct virshSnap, count + 1); + else + snaplist->snaps =3D g_new0(struct virshSnap, count); snaplist->nsnaps =3D count; for (i =3D 0; i < count; i++) snaplist->snaps[i].snap =3D snaps[i]; --=20 2.26.2 From nobody Mon Apr 29 13:57:49 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=1601917444; cv=none; d=zohomail.com; s=zohoarc; b=Jr9UepWdlPDJUJEOOl6QZ9pgH4TpY9aIBuAwsGhyQXf2Z9bS457MYkjwHLWtbaFKSTlMpJByeu2S3ZoPVsHqp3TAVGiyXrGAhX4uernTAUAgJoah4OnNasvckkr0vrBdSk0NGbxZLBr1dlMf4znZnJdn40VqPSH2TmK8Yx+rNfI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601917444; 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=5vWcy165APdrpANTGw4DwYvfaN4yuYm8RwDA33JbeHQ=; b=BXnCK/SbCYODCX/2RrG8LIEYnQwthgdrPPBpp0myzpdE5xDrw4FQvMnqDfkcNLZyMkL93IQlYG36GKSmo3A/ZYfqF4kn60aI+SptyZeNFWG4bD6+BaOXiJcpVKOvEssIqn3PXb+utjS9Bm8WoqXFqwnukA9kw4CtgFj2IRF2cmw= 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 1601917444853214.34405121093982; Mon, 5 Oct 2020 10:04:04 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-3DE5SRu0NpWgG5zxGRS6HQ-1; Mon, 05 Oct 2020 13:03:15 -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 7B4261084C86; Mon, 5 Oct 2020 17:03:09 +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 2E9F773683; Mon, 5 Oct 2020 17:03:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EF58F1826D31; Mon, 5 Oct 2020 17:03:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 095H2oP5009772 for ; Mon, 5 Oct 2020 13:02:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2D93B73673; Mon, 5 Oct 2020 17:02:50 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 82F9173666 for ; Mon, 5 Oct 2020 17:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601917443; 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=5vWcy165APdrpANTGw4DwYvfaN4yuYm8RwDA33JbeHQ=; b=VJjSjXVcRkXRySpR+adRKwF+9sAY4FjYaLNbcc2dJ0V3UtbwcDNqjn2MWW+lg2z836yfag skdbVzVrgteENIjq/N3Jm6lJQpci+rqdBvs4zIe2GUawLL22HdpJzTnmlR5dbg+jEhaOz7 TSdEgbuW97iSYCt6IeE/l9WxcCH80Jw= X-MC-Unique: 3DE5SRu0NpWgG5zxGRS6HQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] virsh: use g_new0 instead of vsh[CM]alloc Date: Mon, 5 Oct 2020 19:02:37 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko Reviewed-by: Erik Skultety --- tools/virsh-checkpoint.c | 5 +++-- tools/virsh-domain-monitor.c | 11 +++++------ tools/virsh-domain.c | 24 ++++++++++++------------ tools/virsh-host.c | 22 +++++++++++----------- tools/virsh-interface.c | 8 ++++---- tools/virsh-network.c | 8 ++++---- tools/virsh-nodedev.c | 12 ++++++------ tools/virsh-nwfilter.c | 8 ++++---- tools/virsh-pool.c | 8 ++++---- tools/virsh-secret.c | 6 +++--- tools/virsh-snapshot.c | 8 ++++---- tools/virsh-volume.c | 8 ++++---- tools/vsh.c | 12 ++++++------ 13 files changed, 70 insertions(+), 70 deletions(-) diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index cefdfd7800..ac9d5bd348 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -583,11 +583,12 @@ virshCheckpointListCollect(vshControl *ctl, size_t i; int count =3D -1; virDomainCheckpointPtr *chks; - virshCheckpointListPtr checkpointlist =3D vshMalloc(ctl, - sizeof(*checkpointli= st)); + virshCheckpointListPtr checkpointlist =3D NULL; virshCheckpointListPtr ret =3D NULL; unsigned int flags =3D orig_flags; =20 + checkpointlist =3D g_new0(struct virshCheckpointList, 1); + if (from) count =3D virDomainCheckpointListAllChildren(from, &chks, flags); else diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index c8a7c0f1b7..e0491d48ac 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1063,8 +1063,7 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd) DOMBLKSTAT_LEGACY_PRINT(3, stats.wr_bytes); DOMBLKSTAT_LEGACY_PRINT(4, stats.errs); } else { - params =3D vshCalloc(ctl, nparams, sizeof(*params)); - + params =3D g_new0(virTypedParameter, nparams); if (virDomainBlockStatsFlags(dom, device, params, &nparams, 0) < 0= ) { vshError(ctl, _("Failed to get block stats for domain '%s' dev= ice '%s'"), name, device); goto cleanup; @@ -1618,7 +1617,7 @@ virshDomainListFree(virshDomainListPtr domlist) static virshDomainListPtr virshDomainListCollect(vshControl *ctl, unsigned int flags) { - virshDomainListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshDomainListPtr list =3D g_new0(struct virshDomainList, 1); size_t i; int ret; int *ids =3D NULL; @@ -1680,7 +1679,7 @@ virshDomainListCollect(vshControl *ctl, unsigned int = flags) } =20 if (nids) { - ids =3D vshMalloc(ctl, sizeof(int) * nids); + ids =3D g_new0(int, nids); =20 if ((nids =3D virConnectListDomains(priv->conn, ids, nids)) < = 0) { vshError(ctl, "%s", _("Failed to list active domains")); @@ -1697,7 +1696,7 @@ virshDomainListCollect(vshControl *ctl, unsigned int = flags) } =20 if (nnames) { - names =3D vshMalloc(ctl, sizeof(char *) * nnames); + names =3D g_new0(char *, nnames); =20 if ((nnames =3D virConnectListDefinedDomains(priv->conn, names, nnames)) < 0) { @@ -1707,7 +1706,7 @@ virshDomainListCollect(vshControl *ctl, unsigned int = flags) } } =20 - list->domains =3D vshMalloc(ctl, sizeof(virDomainPtr) * (nids + nnames= )); + list->domains =3D g_new0(virDomainPtr, nids + nnames); list->ndomains =3D 0; =20 /* get active domains */ diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index b5e7d8f705..8f11393197 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -1431,7 +1431,7 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) goto cleanup; } =20 - params =3D vshCalloc(ctl, nparams, sizeof(*params)); + params =3D g_new0(virTypedParameter, nparams); =20 if (virDomainGetBlockIoTune(dom, disk, params, &nparams, flags) != =3D 0) { vshError(ctl, "%s", @@ -1629,7 +1629,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) } =20 /* now go get all the blkio parameters */ - params =3D vshCalloc(ctl, nparams, sizeof(*params)); + params =3D g_new0(virTypedParameter, nparams); if (virDomainGetBlkioParameters(dom, params, &nparams, flags) !=3D= 0) { vshError(ctl, "%s", _("Unable to get blkio parameters")); goto cleanup; @@ -2372,7 +2372,7 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd) transientjob) { /* New API */ if (bandwidth || granularity || buf_size) { - params =3D vshCalloc(ctl, 3, sizeof(*params)); + params =3D g_new0(virTypedParameter, 3); if (bandwidth) { if (!bytes) { /* bandwidth is ulong MiB/s, but the typed parameter is @@ -3375,7 +3375,7 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd) } =20 /* get all interface parameters */ - params =3D vshCalloc(ctl, nparams, sizeof(*params)); + params =3D g_new0(virTypedParameter, nparams); if (virDomainGetInterfaceParameters(dom, device, params, &nparams,= flags) !=3D 0) { vshError(ctl, "%s", _("Unable to get interface parameters")); goto cleanup; @@ -5243,7 +5243,7 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) } =20 if (nparams) { - params =3D vshMalloc(ctl, sizeof(*params) * nparams); + params =3D g_new0(virTypedParameter, nparams); =20 memset(params, 0, sizeof(*params) * nparams); if (flags || current) { @@ -6894,7 +6894,7 @@ virshVcpuinfoInactive(vshControl *ctl, return false; =20 cpumaplen =3D VIR_CPU_MAPLEN(maxcpu); - cpumaps =3D vshMalloc(ctl, virBitmapSize(vcpus) * cpumaplen); + cpumaps =3D g_new0(unsigned char, virBitmapSize(vcpus) * cpumaplen); =20 if (virDomainGetVcpuPinInfo(dom, virBitmapSize(vcpus), cpumaps, cpumaplen, @@ -6943,9 +6943,9 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd) if (virDomainGetInfo(dom, &info) !=3D 0) return false; =20 - cpuinfo =3D vshMalloc(ctl, sizeof(virVcpuInfo)*info.nrVirtCpu); + cpuinfo =3D g_new0(virVcpuInfo, info.nrVirtCpu); cpumaplen =3D VIR_CPU_MAPLEN(maxcpu); - cpumaps =3D vshMalloc(ctl, info.nrVirtCpu * cpumaplen); + cpumaps =3D g_new0(unsigned char, info.nrVirtCpu * cpumaplen); =20 if ((ncpus =3D virDomainGetVcpus(dom, cpuinfo, info.nrVirtCpu, @@ -7075,7 +7075,7 @@ virshVcpuPinQuery(vshControl *ctl, } =20 cpumaplen =3D VIR_CPU_MAPLEN(maxcpu); - cpumap =3D vshMalloc(ctl, ncpus * cpumaplen); + cpumap =3D g_new0(unsigned char, ncpus * cpumaplen); if ((ncpus =3D virDomainGetVcpuPinInfo(dom, ncpus, cpumap, cpumaplen, flags)) >=3D 0) { table =3D vshTableNew(_("VCPU"), _("CPU Affinity"), NULL); @@ -7291,7 +7291,7 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd) flags =3D VIR_DOMAIN_AFFECT_CURRENT; =20 cpumaplen =3D VIR_CPU_MAPLEN(maxcpu); - cpumap =3D vshMalloc(ctl, cpumaplen); + cpumap =3D g_new0(unsigned char, cpumaplen); if (virDomainGetEmulatorPinInfo(dom, cpumap, cpumaplen, flags) >=3D 0) { vshPrintExtra(ctl, "%s %s\n", _("emulator:"), _("CPU Affinity"= )); @@ -9281,7 +9281,7 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd) } =20 /* now go get all the memory parameters */ - params =3D vshCalloc(ctl, nparams, sizeof(*params)); + params =3D g_new0(virTypedParameter, nparams); if (virDomainGetMemoryParameters(dom, params, &nparams, flags) != =3D 0) { vshError(ctl, "%s", _("Unable to get memory parameters")); goto cleanup; @@ -9554,7 +9554,7 @@ cmdNumatune(vshControl * ctl, const vshCmd * cmd) } =20 /* now go get all the numa parameters */ - params =3D vshCalloc(ctl, nparams, sizeof(*params)); + params =3D g_new0(virTypedParameter, nparams); if (virDomainGetNumaParameters(dom, params, &nparams, flags) !=3D = 0) { vshError(ctl, "%s", _("Unable to get numa parameters")); goto cleanup; diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 722c47958b..d4eb3f977d 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -197,8 +197,8 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd) goto cleanup; } =20 - nodes_free =3D vshCalloc(ctl, nodes_cnt, sizeof(*nodes_free)); - nodes_id =3D vshCalloc(ctl, nodes_cnt, sizeof(*nodes_id)); + nodes_free =3D g_new0(unsigned long long, nodes_cnt); + nodes_id =3D g_new0(unsigned long, nodes_cnt); =20 for (i =3D 0; i < nodes_cnt; i++) { unsigned long id; @@ -346,7 +346,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd) } } =20 - pagesize =3D vshCalloc(ctl, nodes_cnt, sizeof(*pagesize)); + pagesize =3D g_new0(unsigned int, nodes_cnt); =20 for (i =3D 0; i < nodes_cnt; i++) { char *val =3D virXMLPropString(nodes[i], "size"); @@ -379,12 +379,12 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd) npages =3D nodes_cnt; VIR_FREE(nodes); } else { - pagesize =3D vshMalloc(ctl, sizeof(*pagesize)); + pagesize =3D g_new0(unsigned int, 1); pagesize[0] =3D kibibytes; npages =3D 1; } =20 - counts =3D vshCalloc(ctl, npages, sizeof(*counts)); + counts =3D g_new0(unsigned long long, npages); =20 nodes_cnt =3D virXPathNodeSet("/capabilities/host/topology/cells/c= ell", ctxt, &nodes); @@ -429,10 +429,10 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd) } =20 /* page size is expected in kibibytes */ - pagesize =3D vshMalloc(ctl, sizeof(*pagesize)); + pagesize =3D g_new0(unsigned int, 1); pagesize[0] =3D kibibytes; =20 - counts =3D vshMalloc(ctl, sizeof(*counts)); + counts =3D g_new0(unsigned long long, 1); =20 if (virNodeGetFreePages(priv->conn, 1, pagesize, cell, 1, counts, 0) < 0) @@ -816,7 +816,7 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) } =20 memset(cpu_stats, 0, sizeof(cpu_stats)); - params =3D vshCalloc(ctl, nparams, sizeof(*params)); + params =3D g_new0(virNodeCPUStats, nparams); =20 for (i =3D 0; i < 2; i++) { if (virNodeGetCPUStats(priv->conn, cpuNum, params, &nparams, 0) != =3D 0) { @@ -930,7 +930,7 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd) } =20 /* now go get all the memory parameters */ - params =3D vshCalloc(ctl, nparams, sizeof(*params)); + params =3D g_new0(virNodeMemoryStats, nparams); if (virNodeGetMemoryStats(priv->conn, cellNum, params, &nparams, 0) != =3D 0) { vshError(ctl, "%s", _("Unable to get memory stats")); goto cleanup; @@ -1158,7 +1158,7 @@ vshExtractCPUDefXMLs(vshControl *ctl, goto error; } =20 - cpus =3D vshCalloc(ctl, n + 1, sizeof(const char *)); + cpus =3D g_new0(char *, n + 1); =20 for (i =3D 0; i < n; i++) { /* If the user provided domain capabilities XML, we need to replace @@ -1567,7 +1567,7 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd) } =20 /* Now go get all the memory parameters */ - params =3D vshCalloc(ctl, nparams, sizeof(*params)); + params =3D g_new0(virTypedParameter, nparams); if (virNodeGetMemoryParameters(priv->conn, params, &nparams, flags= ) !=3D 0) { vshError(ctl, "%s", _("Unable to get memory parameters")); goto cleanup; diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 2bca2483dd..8cdbc6e85f 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -185,7 +185,7 @@ static virshInterfaceListPtr virshInterfaceListCollect(vshControl *ctl, unsigned int flags) { - virshInterfaceListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshInterfaceListPtr list =3D g_new0(struct virshInterfaceList, 1); size_t i; int ret; char **activeNames =3D NULL; @@ -226,7 +226,7 @@ virshInterfaceListCollect(vshControl *ctl, goto cleanup; } if (nActiveIfaces) { - activeNames =3D vshMalloc(ctl, sizeof(char *) * nActiveIfaces); + activeNames =3D g_new0(char *, nActiveIfaces); =20 if ((nActiveIfaces =3D virConnectListInterfaces(priv->conn, ac= tiveNames, nActiveIfaces)) = < 0) { @@ -243,7 +243,7 @@ virshInterfaceListCollect(vshControl *ctl, goto cleanup; } if (nInactiveIfaces) { - inactiveNames =3D vshMalloc(ctl, sizeof(char *) * nInactiveIfa= ces); + inactiveNames =3D g_new0(char *, nInactiveIfaces); =20 if ((nInactiveIfaces =3D virConnectListDefinedInterfaces(priv->conn, inactiveN= ames, @@ -261,7 +261,7 @@ virshInterfaceListCollect(vshControl *ctl, return list; } =20 - list->ifaces =3D vshMalloc(ctl, sizeof(virInterfacePtr) * (nAllIfaces)= ); + list->ifaces =3D g_new0(virInterfacePtr, nAllIfaces); list->nifaces =3D 0; =20 /* get active interfaces */ diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 8a683969f9..c5347660de 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -468,7 +468,7 @@ static virshNetworkListPtr virshNetworkListCollect(vshControl *ctl, unsigned int flags) { - virshNetworkListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshNetworkListPtr list =3D g_new0(struct virshNetworkList, 1); size_t i; int ret; char **names =3D NULL; @@ -539,7 +539,7 @@ virshNetworkListCollect(vshControl *ctl, if (nAllNets =3D=3D 0) return list; =20 - names =3D vshMalloc(ctl, sizeof(char *) * nAllNets); + names =3D g_new0(char *, nAllNets); =20 /* Retrieve a list of active network names */ if (!VSH_MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE) || @@ -562,7 +562,7 @@ virshNetworkListCollect(vshControl *ctl, } } =20 - list->nets =3D vshMalloc(ctl, sizeof(virNetworkPtr) * (nAllNets)); + list->nets =3D g_new0(virNetworkPtr, nAllNets); list->nnets =3D 0; =20 /* get active networks */ @@ -1685,7 +1685,7 @@ virshNetworkPortListCollect(vshControl *ctl, const vshCmd *cmd, unsigned int flags) { - virshNetworkPortListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshNetworkPortListPtr list =3D g_new0(struct virshNetworkPortList, 1= ); int ret; virNetworkPtr network =3D NULL; bool success =3D false; diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 2edd403a64..483e36bd53 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -216,7 +216,7 @@ virshNodeDeviceListCollect(vshControl *ctl, int ncapnames, unsigned int flags) { - virshNodeDeviceListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshNodeDeviceListPtr list =3D g_new0(struct virshNodeDeviceList, 1); size_t i; int ret; virNodeDevicePtr device; @@ -256,7 +256,7 @@ virshNodeDeviceListCollect(vshControl *ctl, if (ndevices =3D=3D 0) return list; =20 - names =3D vshMalloc(ctl, sizeof(char *) * ndevices); + names =3D g_new0(char *, ndevices); =20 ndevices =3D virNodeListDevices(priv->conn, NULL, names, ndevices, 0); if (ndevices < 0) { @@ -264,7 +264,7 @@ virshNodeDeviceListCollect(vshControl *ctl, goto cleanup; } =20 - list->devices =3D vshMalloc(ctl, sizeof(virNodeDevicePtr) * (ndevices)= ); + list->devices =3D g_new0(virNodeDevicePtr, ndevices); list->ndevices =3D 0; =20 /* get the node devices */ @@ -295,7 +295,7 @@ virshNodeDeviceListCollect(vshControl *ctl, goto cleanup; } =20 - caps =3D vshMalloc(ctl, sizeof(char *) * ncaps); + caps =3D g_new0(char *, ncaps); =20 if ((ncaps =3D virNodeDeviceListCaps(device, caps, ncaps)) < 0) { vshError(ctl, "%s", _("Failed to get capability names of the d= evice")); @@ -475,8 +475,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G= _GNUC_UNUSED) } =20 if (tree) { - char **parents =3D vshMalloc(ctl, sizeof(char *) * list->ndevices); - char **names =3D vshMalloc(ctl, sizeof(char *) * list->ndevices); + char **parents =3D g_new0(char *, list->ndevices); + char **names =3D g_new0(char *, list->ndevices); struct virshNodeList arrays =3D { names, parents }; =20 for (i =3D 0; i < list->ndevices; i++) diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 38790b0081..768a96e949 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -243,7 +243,7 @@ static virshNWFilterListPtr virshNWFilterListCollect(vshControl *ctl, unsigned int flags) { - virshNWFilterListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshNWFilterListPtr list =3D g_new0(struct virshNWFilterList, 1); size_t i; int ret; virNWFilterPtr filter; @@ -285,7 +285,7 @@ virshNWFilterListCollect(vshControl *ctl, if (nfilters =3D=3D 0) return list; =20 - names =3D vshMalloc(ctl, sizeof(char *) * nfilters); + names =3D g_new0(char *, nfilters); =20 nfilters =3D virConnectListNWFilters(priv->conn, names, nfilters); if (nfilters < 0) { @@ -293,7 +293,7 @@ virshNWFilterListCollect(vshControl *ctl, goto cleanup; } =20 - list->filters =3D vshMalloc(ctl, sizeof(virNWFilterPtr) * nfilters); + list->filters =3D g_new0(virNWFilterPtr, nfilters); list->nfilters =3D 0; =20 /* get the network filters */ @@ -664,7 +664,7 @@ static virshNWFilterBindingListPtr virshNWFilterBindingListCollect(vshControl *ctl, unsigned int flags) { - virshNWFilterBindingListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshNWFilterBindingListPtr list =3D g_new0(struct virshNWFilterBindin= gList, 1); int ret; bool success =3D false; virshControlPtr priv =3D ctl->privData; diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 0f82cdb308..7835fa6d75 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -859,7 +859,7 @@ static virshStoragePoolListPtr virshStoragePoolListCollect(vshControl *ctl, unsigned int flags) { - virshStoragePoolListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshStoragePoolListPtr list =3D g_new0(struct virshStoragePoolList, 1= ); size_t i; int ret; char **names =3D NULL; @@ -936,7 +936,7 @@ virshStoragePoolListCollect(vshControl *ctl, if (nAllPools =3D=3D 0) return list; =20 - names =3D vshMalloc(ctl, sizeof(char *) * nAllPools); + names =3D g_new0(char *, nAllPools); =20 /* Retrieve a list of active storage pool names */ if (!VSH_MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE) || @@ -959,7 +959,7 @@ virshStoragePoolListCollect(vshControl *ctl, } } =20 - list->pools =3D vshMalloc(ctl, sizeof(virStoragePoolPtr) * (nAllPools)= ); + list->pools =3D g_new0(virStoragePoolPtr, nAllPools); list->npools =3D 0; =20 /* get active pools */ @@ -1247,7 +1247,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC= _UNUSED) if (!(list =3D virshStoragePoolListCollect(ctl, flags))) goto cleanup; =20 - poolInfoTexts =3D vshCalloc(ctl, list->npools, sizeof(*poolInfoTexts)); + poolInfoTexts =3D g_new0(struct poolInfoText, list->npools); =20 /* Collect the storage pool information for display */ for (i =3D 0; i < list->npools; i++) { diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 7f1df30090..16accc8ad2 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -425,7 +425,7 @@ static virshSecretListPtr virshSecretListCollect(vshControl *ctl, unsigned int flags) { - virshSecretListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshSecretListPtr list =3D g_new0(struct virshSecretList, 1); size_t i; int ret; virSecretPtr secret; @@ -470,7 +470,7 @@ virshSecretListCollect(vshControl *ctl, if (nsecrets =3D=3D 0) return list; =20 - uuids =3D vshMalloc(ctl, sizeof(char *) * nsecrets); + uuids =3D g_new0(char *, nsecrets); =20 nsecrets =3D virConnectListSecrets(priv->conn, uuids, nsecrets); if (nsecrets < 0) { @@ -478,7 +478,7 @@ virshSecretListCollect(vshControl *ctl, goto cleanup; } =20 - list->secrets =3D vshMalloc(ctl, sizeof(virSecretPtr) * (nsecrets)); + list->secrets =3D g_new0(virSecretPtr, nsecrets); list->nsecrets =3D 0; =20 /* get the secrets */ diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index b4498df298..478657b5b6 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -1069,7 +1069,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPt= r dom, bool descendants =3D false; bool roots =3D false; virDomainSnapshotPtr *snaps; - virshSnapshotListPtr snaplist =3D vshMalloc(ctl, sizeof(*snaplist)); + virshSnapshotListPtr snaplist =3D g_new0(struct virshSnapshotList, 1); virshSnapshotListPtr ret =3D NULL; const char *fromname =3D NULL; int start_index =3D -1; @@ -1221,7 +1221,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPt= r dom, if (!count) goto success; =20 - names =3D vshCalloc(ctl, sizeof(*names), count); + names =3D g_new0(char *, count); =20 /* Now that we have a count, collect the list. */ if (from && !priv->useSnapshotOld) { @@ -1242,7 +1242,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPt= r dom, if (count < 0) goto cleanup; =20 - snaplist->snaps =3D vshCalloc(ctl, sizeof(*snaplist->snaps), count); + snaplist->snaps =3D g_new0(struct virshSnap, count); snaplist->nsnaps =3D count; for (i =3D 0; i < count; i++) { snaplist->snaps[i].snap =3D virDomainSnapshotLookupByName(dom, @@ -1310,7 +1310,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPt= r dom, } } if (!changed) { - ret =3D vshMalloc(ctl, sizeof(*snaplist)); + ret =3D g_new0(struct virshSnapshotList, 1); goto cleanup; } while (changed && remaining) { diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index cfdda619a7..c86abb863f 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -1283,7 +1283,7 @@ virshStorageVolListCollect(vshControl *ctl, virStoragePoolPtr pool, unsigned int flags) { - virshStorageVolListPtr list =3D vshMalloc(ctl, sizeof(*list)); + virshStorageVolListPtr list =3D g_new0(struct virshStorageVolList, 1); size_t i; char **names =3D NULL; virStorageVolPtr vol =3D NULL; @@ -1322,13 +1322,13 @@ virshStorageVolListCollect(vshControl *ctl, return list; =20 /* Retrieve the list of volume names in the pool */ - names =3D vshCalloc(ctl, nvols, sizeof(*names)); + names =3D g_new0(char *, nvols); if ((nvols =3D virStoragePoolListVolumes(pool, names, nvols)) < 0) { vshError(ctl, "%s", _("Failed to list storage volumes")); goto cleanup; } =20 - list->vols =3D vshMalloc(ctl, sizeof(virStorageVolPtr) * (nvols)); + list->vols =3D g_new0(virStorageVolPtr, nvols); list->nvols =3D 0; =20 /* get the vols */ @@ -1415,7 +1415,7 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd G_GNUC_= UNUSED) goto cleanup; =20 if (list->nvols > 0) - volInfoTexts =3D vshCalloc(ctl, list->nvols, sizeof(*volInfoTexts)= ); + volInfoTexts =3D g_new0(struct volInfoText, list->nvols); =20 /* Collect the rest of the volume information for display */ for (i =3D 0; i < list->nvols; i++) { diff --git a/tools/vsh.c b/tools/vsh.c index 0eddd5349d..98066d17bf 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -1450,7 +1450,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) goto syntaxError; if (tk !=3D VSH_TK_ARG) { if (partial) { - vshCmdOpt *arg =3D vshMalloc(ctl, sizeof(vshCm= dOpt)); + vshCmdOpt *arg =3D g_new0(vshCmdOpt, 1); arg->def =3D opt; arg->data =3D tkdata; tkdata =3D NULL; @@ -1499,7 +1499,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) } if (opt) { /* save option */ - vshCmdOpt *arg =3D vshMalloc(ctl, sizeof(vshCmdOpt)); + vshCmdOpt *arg =3D g_new0(vshCmdOpt, 1); =20 arg->def =3D opt; arg->data =3D tkdata; @@ -1523,7 +1523,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) =20 /* command parsed -- allocate new struct for the command */ if (cmd) { - vshCmd *c =3D vshMalloc(ctl, sizeof(vshCmd)); + vshCmd *c =3D g_new0(vshCmd, 1); vshCmdOpt *tmpopt =3D first; =20 /* if we encountered --help, replace parsed command with @@ -1535,7 +1535,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) =20 help =3D vshCmddefSearch("help"); vshCommandOptFree(first); - first =3D vshMalloc(ctl, sizeof(vshCmdOpt)); + first =3D g_new0(vshCmdOpt, 1); first->def =3D help->opts; first->data =3D g_strdup(cmd->name); first->next =3D NULL; @@ -1579,7 +1579,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *pa= rser, vshCmd **partial) if (partial) { vshCmd *tmp; =20 - tmp =3D vshMalloc(ctl, sizeof(*tmp)); + tmp =3D g_new0(vshCmd, 1); tmp->opts =3D first; tmp->def =3D cmd; =20 @@ -2653,7 +2653,7 @@ vshReadlineOptionsGenerator(const char *text, } =20 name_len =3D strlen(name); - ret[ret_size] =3D vshMalloc(NULL, name_len + 3); + ret[ret_size] =3D g_new0(char, name_len + 3); g_snprintf(ret[ret_size], name_len + 3, "--%s", name); ret_size++; /* Terminate the string list properly. */ --=20 2.26.2 From nobody Mon Apr 29 13:57:49 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=1601917401; cv=none; d=zohomail.com; s=zohoarc; b=VYZ0UKTZ0lSohbiynardYY2uvLzcmNDJRuAuyk3VCF5rZ0Bcg/WI0hJ/3+wokYHSaarPJDHfAGeVa52vtzDN63Deh3JkdLXRae0xWSjrex6oyBNpDCCIQG7h5LNEnpNREmi1IWjid23GM0CBRU2E8nMsQtYf+fd2exkUnjQK9sk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601917401; 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=9tyUi2CZS99jkiIN460rEAOzAqas1d6V7FzKQl7TCyU=; b=LkJherhomaQdKfoT3TtPbf+FIrL8zLgukyNQZFGHC7QsI02Q4zDMjKAeQts0sKn/5+9XKzlXeLsbABbtjxNZTT84i4YiApLVNZh7A6nLa/PiArhiVXkxOSOdUu2T0+tbVjipB1E9X/BgGT7dgxUgcSvUxDd+AGDo2w9EBQ2EGEo= 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 1601917401679225.967853573625; Mon, 5 Oct 2020 10:03:21 -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-130-60IrpHXbPiCj24a7xfAN1g-1; Mon, 05 Oct 2020 13:03:15 -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 DABDA801AF4; Mon, 5 Oct 2020 17:03:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B697D5579B; Mon, 5 Oct 2020 17:03:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8309044A6C; Mon, 5 Oct 2020 17:03:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 095H2pee009782 for ; Mon, 5 Oct 2020 13:02:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id F2ADC73673; Mon, 5 Oct 2020 17:02:50 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AEB373666 for ; Mon, 5 Oct 2020 17:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601917400; 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=9tyUi2CZS99jkiIN460rEAOzAqas1d6V7FzKQl7TCyU=; b=Z9N6DqUrBTvTzLj9SQ5rQDD2Fl7nCHYxN1Kzuoi3x2Lb9LA1QVdTprWnFD2mJI5HVKVph9 l0ALjhbSVEdWUn4OkotHbg2OMdiSXe5wbApuatOMTACFExRHjHCBWoeVdxjzyJ25Ced3B0 xlmq33O+94KvSBzoxRbpIxjaTAruxR0= X-MC-Unique: 60IrpHXbPiCj24a7xfAN1g-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] virsh: delete vsh[CM]alloc Date: Mon, 5 Oct 2020 19:02:38 +0200 Message-Id: <64dce8f0ce037a3bff1ab579c82bf3a3e234d28d.1601917336.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko Reviewed-by: Erik Skultety --- tools/vsh.c | 18 ------------------ tools/vsh.h | 6 ------ 2 files changed, 24 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 98066d17bf..ca92bcd78c 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -100,24 +100,6 @@ vshPrettyCapacity(unsigned long long val, const char *= *unit) } =20 =20 -void * -_vshMalloc(vshControl *ctl, size_t size, const char *filename, int line) -{ - char *x; - - if (VIR_ALLOC_N(x, size) =3D=3D 0) - return x; - vshError(ctl, _("%s: %d: failed to allocate %d bytes"), - filename, line, (int) size); - exit(EXIT_FAILURE); -} - -void * -vshCalloc(vshControl *ctl G_GNUC_UNUSED, size_t nmemb, size_t size) -{ - return g_malloc0_n(nmemb, size); -} - int vshNameSorter(const void *a, const void *b) { diff --git a/tools/vsh.h b/tools/vsh.h index 0a40995bf5..5583fef9cc 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -465,12 +465,6 @@ char * vshReadline(vshControl *ctl, const char *prompt= ); =20 void vshReadlineHistoryAdd(const char *cmd); =20 -/* allocation wrappers */ -void *_vshMalloc(vshControl *ctl, size_t sz, const char *filename, int lin= e); -#define vshMalloc(_ctl, _sz) _vshMalloc(_ctl, _sz, __FILE__, __LINE__) - -void *vshCalloc(vshControl *ctl, size_t nmemb, size_t sz); - /* Macros to help dealing with mutually exclusive options. */ =20 /* VSH_EXCLUSIVE_OPTIONS_EXPR: --=20 2.26.2 From nobody Mon Apr 29 13:57:49 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=1601917387; cv=none; d=zohomail.com; s=zohoarc; b=KnAbHIqQFBerH70I60fS9QAE9NjvX7zY7DCVE+O2/uFdbAwJ1RsLaB8qPVH6F3H+A4zq/Qs+l7SlYAd2cQ2QKYLm07F/XeKfi36hBlCpDXw0vzBEz3Jg2Jau3Ar93FZTmpsH8uEUhWKDN8nYbTkuTFbqEfiYaKeD9DcXpicBBxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601917387; 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=nOLEg/75AMUOd8GQ6uknbixXeIsObDcOq18v8lAo8SY=; b=lzXd4s+ntU2knHkmmgE9dlmTWMTFQus23EfOfp9fZEQ9G9wcbAq7CWRsUlBIuYycFAjma5t9Lp0O+12FGD3/tXowmFUN35nED+EK0g/GXGNijiH1yVZK8aPNFO7Lg9M0vPa0VZ8ZbshigWTgw+qLLw3Yg13sd15dJUdCwLRl0iI= 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 1601917386995134.20411856854184; Mon, 5 Oct 2020 10:03:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-395-YW96enfmPGu6CzQV-4RZPA-1; Mon, 05 Oct 2020 13:03:02 -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 52BB81084C81; Mon, 5 Oct 2020 17:02:56 +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 D753A73674; Mon, 5 Oct 2020 17:02:55 +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 15CF644A66; Mon, 5 Oct 2020 17:02:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 095H2p8l009788 for ; Mon, 5 Oct 2020 13:02:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id C402C73673; Mon, 5 Oct 2020 17:02:51 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BF2F73666 for ; Mon, 5 Oct 2020 17:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601917385; 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=nOLEg/75AMUOd8GQ6uknbixXeIsObDcOq18v8lAo8SY=; b=Zl9tpkhrGrbwPwS+FLKKGW9GG0fDtSRW08W6y4zGLn6oZa33EeeYL4GUSlOKIObBFQUJz8 MYFbW5yUbc6pAbLISB305Mux5pE0XvfGEbhDHubGKEuAdYIjkiXjTryuS54TH6DYBGuafg ZtWabqKk+had1V/0g5lGeVrBqAHRNk0= X-MC-Unique: YW96enfmPGu6CzQV-4RZPA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] virsh: network-port: remove pointless comment Date: Mon, 5 Oct 2020 19:02:39 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) We do not have a legacy API for listing network ports so there's nothing to fall back on. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Erik Skultety --- tools/virsh-network.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/virsh-network.c b/tools/virsh-network.c index c5347660de..745afc537d 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1693,7 +1693,6 @@ virshNetworkPortListCollect(vshControl *ctl, if (!(network =3D virshCommandOptNetwork(ctl, cmd, NULL))) goto cleanup; =20 - /* try the list with flags support (0.10.2 and later) */ if ((ret =3D virNetworkListAllPorts(network, &list->ports, flags)) < 0) --=20 2.26.2