From nobody Mon Feb 9 05:44:43 2026 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=1601624710; cv=none; d=zohomail.com; s=zohoarc; b=Yhu/j/hZfa+waZcsOdrBi1AcSx6ALyHA6SLCgyK/x7BwwntB8z/0iHraYrsiwv0YN8lo6V7wZqAzrJtlWPDiTWRxe19mu4uyxRQUL5IvntqmuhvUpr0Y3UiazKHEMacPvVbN6s6748JluRFUQeTHe17QhGuPVQdjXRaMNcPTjf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601624710; 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=V0mnIy2N280/RWWcqF3wCvLwkm6jRCqKkIIQsqiJWis=; b=LAI5SFGHHLi3lVq+szGUasc19aPLMG7aEW7DmYbaKQCy+Me48AZtCeLthVK8RrfTrAhcYisc7fZVNGQCkPJMdiSUnyfeejRuDcIIfQYnxiaAu85DT5kr0/39BsuvzML+41GprhopJZJUqNXF4USnAqf9roNgkzwsIdW3WMq2jCs= 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 1601624710420744.2460860195706; Fri, 2 Oct 2020 00:45:10 -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-253-r5BM7K7tNpWKoInZqz3AfQ-1; Fri, 02 Oct 2020 03:43:50 -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 334246408C; Fri, 2 Oct 2020 07:43:44 +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 105DF10016DA; Fri, 2 Oct 2020 07:43:44 +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 CFF7A18199F8; Fri, 2 Oct 2020 07:43:43 +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 0927hTRP004260 for ; Fri, 2 Oct 2020 03:43:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4C0DE19931; Fri, 2 Oct 2020 07:43:29 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6BFA1992F for ; Fri, 2 Oct 2020 07:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601624709; 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=V0mnIy2N280/RWWcqF3wCvLwkm6jRCqKkIIQsqiJWis=; b=iLPF8w8B4jlkFqfy0Y0wtMJhPbHkUBUuW6W9UCDLnCI8c4WirVOZ5f0kLFS+LCJJI6N3uU CDOj/+CFsoJZPY0d+EEp58KqxobW0Ckiu7b7aEI7XAnqhEu3L2Cgios/u8VJYnf6zhgp9E qzl1DW927WhQcwsJbivTBN98UpZymBM= X-MC-Unique: r5BM7K7tNpWKoInZqz3AfQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/15] util: bitmp: Remove virBitmapNewEmpty Date: Fri, 2 Oct 2020 09:43:07 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.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 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" It can be replaced by virBitmapNew(0). Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/numa_conf.c | 2 +- src/libvirt_private.syms | 1 - src/util/virbitmap.c | 16 +--------------- src/util/virbitmap.h | 1 - src/util/virhostcpu.c | 4 ++-- src/util/virnuma.c | 2 +- src/util/virtpm.c | 2 +- tests/virbitmaptest.c | 8 ++++---- 8 files changed, 10 insertions(+), 26 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index cc6c77f105..b5ddf2c134 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1374,7 +1374,7 @@ virDomainNumaDefValidate(const virDomainNuma *def) for (i =3D 0; i < def->nmem_nodes; i++) { const virDomainNumaNode *node =3D &def->mem_nodes[i]; - g_autoptr(virBitmap) levelsSeen =3D virBitmapNewEmpty(); + g_autoptr(virBitmap) levelsSeen =3D virBitmapNew(0); for (j =3D 0; j < node->ncaches; j++) { const virDomainNumaCache *cache =3D &node->caches[j]; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 185f120f6b..01ae3cad93 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1683,7 +1683,6 @@ virBitmapLastSetBit; virBitmapNew; virBitmapNewCopy; virBitmapNewData; -virBitmapNewEmpty; virBitmapNewString; virBitmapNextClearBit; virBitmapNextSetBit; diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 5d224a8def..1bff5d4ae6 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -84,20 +84,6 @@ virBitmapNew(size_t size) } -/** - * virBitmapNewEmpty: - * - * Allocate an empty bitmap. It can be used with self-expanding APIs. - * - * Returns a pointer to the allocated bitmap. - */ -virBitmapPtr -virBitmapNewEmpty(void) -{ - return g_new0(virBitmap, 1); -} - - /** * virBitmapFree: * @bitmap: previously allocated bitmap @@ -576,7 +562,7 @@ virBitmapParse(const char *str, virBitmapPtr virBitmapParseUnlimited(const char *str) { - virBitmapPtr bitmap =3D virBitmapNewEmpty(); + virBitmapPtr bitmap =3D virBitmapNew(0); bool neg =3D false; const char *cur =3D str; char *tmp; diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h index 88af3bbadc..cd5caa6f61 100644 --- a/src/util/virbitmap.h +++ b/src/util/virbitmap.h @@ -33,7 +33,6 @@ typedef virBitmap *virBitmapPtr; * Allocate a bitmap capable of containing @size bits. */ virBitmapPtr virBitmapNew(size_t size); -virBitmapPtr virBitmapNewEmpty(void) G_GNUC_WARN_UNUSED_RESULT; /* * Free previously allocated bitmap diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index f7e92cd924..c00a393def 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -336,7 +336,7 @@ virHostCPUParseNode(const char *node, goto cleanup; /* enumerate sockets in the node */ - sockets_map =3D virBitmapNewEmpty(); + sockets_map =3D virBitmapNew(0); while ((direrr =3D virDirRead(cpudir, &cpudirent, node)) > 0) { if (sscanf(cpudirent->d_name, "cpu%u", &cpu) !=3D 1) @@ -372,7 +372,7 @@ virHostCPUParseNode(const char *node, goto cleanup; for (i =3D 0; i < sock_max; i++) - cores_maps[i] =3D virBitmapNewEmpty(); + cores_maps[i] =3D virBitmapNew(0); /* Iterate over all CPUs in the node, in ascending order */ for (cpu =3D 0; cpu < npresent_cpus; cpu++) { diff --git a/src/util/virnuma.c b/src/util/virnuma.c index 39f0f30917..5a1218cdf2 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -311,7 +311,7 @@ virNumaNodesetToCPUset(virBitmapPtr nodeset, if (!nodeset) return 0; - allNodesCPUs =3D virBitmapNewEmpty(); + allNodesCPUs =3D virBitmapNew(0); nodesetSize =3D virBitmapSize(nodeset); for (i =3D 0; i < nodesetSize; i++) { diff --git a/src/util/virtpm.c b/src/util/virtpm.c index 1a3b5a05aa..0e11674a3c 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -183,7 +183,7 @@ virTPMExecGetCaps(virCommandPtr cmd, if (virCommandRun(cmd, &exitstatus) < 0) return NULL; - bitmap =3D virBitmapNewEmpty(); + bitmap =3D virBitmapNew(0); /* older version does not support --print-capabilties -- that's fine */ if (exitstatus !=3D 0) { diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index c14a6c7e26..255492c9e8 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -178,7 +178,7 @@ test4(const void *data G_GNUC_UNUSED) /* 0. empty set */ - bitmap =3D virBitmapNewEmpty(); + bitmap =3D virBitmapNew(0); if (virBitmapNextSetBit(bitmap, -1) !=3D -1) return -1; @@ -571,7 +571,7 @@ test11(const void *opaque) static int test12(const void *opaque G_GNUC_UNUSED) { - g_autoptr(virBitmap) map =3D virBitmapNewEmpty(); + g_autoptr(virBitmap) map =3D virBitmapNew(0); TEST_MAP(0, ""); @@ -684,11 +684,11 @@ test15(const void *opaque) } -/* virBitmapNewEmpty + virBitmapToString */ +/* virBitmapNew(0) + virBitmapToString */ static int test16(const void *opaque G_GNUC_UNUSED) { - g_autoptr(virBitmap) map =3D virBitmapNewEmpty(); + g_autoptr(virBitmap) map =3D virBitmapNew(0); g_autofree char *res_empty =3D NULL; g_autofree char *res_set =3D NULL; --=20 2.26.2