From nobody Mon Feb 9 00:07:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1617971593; cv=none; d=zohomail.com; s=zohoarc; b=GmN4c+zIl/yVhdyoiLNCJALdUzoxG2e2HDArLeSSXeH3c6tWRwjdaPfCzYup8aV5wWY5cijFGss8kWmIFuJiumLiA1oP7hvyWLDHPcelO1ar2gwSfIIjWvWwu+t0Q6cjB5t+4mpNJcQqNmOCkLBDToB3PvpuszWVUuM4c83Whkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617971593; 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=U/9in3J+MlBOHpyfJsiEWff2YPlGxLXX6vUfT7wM05I=; b=VRNT7jvIC3V634DiYZv3tb38mkAGL6dKqKKme2NBzk9ArIubPMHgeoUOQoHXwbYr/iJMXcr93WxXamxVagOHQt2JOwp/R3Vt1XI/c3NUOrMNCSCT192kz+miqPrdmVtFddV8v0GU6sXxNUmd1TwQ0w2vgr41Uhlc3oDdYvBvszg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1617971593677317.0543430211186; Fri, 9 Apr 2021 05:33:13 -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-400-lCioVYxSM5qYXmaOhGh1Ww-1; Fri, 09 Apr 2021 08:33:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C64A9817472; Fri, 9 Apr 2021 12:33:05 +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 9EE6C60C5F; Fri, 9 Apr 2021 12:33:05 +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 5B8D75534D; Fri, 9 Apr 2021 12:33:05 +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 139CWjqg006548 for ; Fri, 9 Apr 2021 08:32:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C03618400; Fri, 9 Apr 2021 12:32:45 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FDDF627DC for ; Fri, 9 Apr 2021 12:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617971592; 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=U/9in3J+MlBOHpyfJsiEWff2YPlGxLXX6vUfT7wM05I=; b=NLJ1MTquRUMNNG2GzMgCSaxxP3YGuJyCBJqf8y7bC26zkq4foyNfU+YxcTiluYt1KEWKoj 3BgQW7oCRsiYTIEdC01JxqNrxnf2ZSWBA0Z1HXL7uHHvlJXLz+4oodDx1Oh72bENaxyZy4 qs95nH0KCgwuAlDpt4pOh7AZ433glB8= X-MC-Unique: lCioVYxSM5qYXmaOhGh1Ww-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/3] util: json: Remove virJSONValueGetArrayAsBitmap Date: Fri, 9 Apr 2021 14:32:36 +0200 Message-Id: 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 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.12 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" The function is not used. Signed-off-by: Peter Krempa --- src/libvirt_private.syms | 1 - src/util/virjson.c | 51 ---------------------------------------- src/util/virjson.h | 2 -- 3 files changed, 54 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index f36400b5f6..0801728a74 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2478,7 +2478,6 @@ virJSONValueArraySteal; virJSONValueCopy; virJSONValueFree; virJSONValueFromString; -virJSONValueGetArrayAsBitmap; virJSONValueGetBoolean; virJSONValueGetNumberDouble; virJSONValueGetNumberInt; diff --git a/src/util/virjson.c b/src/util/virjson.c index 82081db870..746386c619 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -1174,57 +1174,6 @@ virJSONValueGetBoolean(virJSONValuePtr val, } -/** - * virJSONValueGetArrayAsBitmap: - * @val: JSON array to convert to bitmap - * @bitmap: New bitmap is allocated filled and returned via this argument - * - * Attempts a conversion of a JSON array to a bitmap. The members of the a= rray - * must be non-negative integers for the conversion to succeed. This funct= ion - * does not report libvirt errors so that it can be used to probe that the - * array can be represented as a bitmap. - * - * Returns 0 on success and fills @bitmap; -1 on error and @bitmap is set= to - * NULL. - */ -int -virJSONValueGetArrayAsBitmap(const virJSONValue *val, - virBitmapPtr *bitmap) -{ - virJSONValuePtr elem; - size_t i; - g_autofree unsigned long long *elems =3D NULL; - unsigned long long maxelem =3D 0; - - *bitmap =3D NULL; - - if (val->type !=3D VIR_JSON_TYPE_ARRAY) - return -1; - - elems =3D g_new0(unsigned long long, val->data.array.nvalues); - - /* first pass converts array members to numbers and finds the maximum = */ - for (i =3D 0; i < val->data.array.nvalues; i++) { - elem =3D val->data.array.values[i]; - - if (elem->type !=3D VIR_JSON_TYPE_NUMBER || - virStrToLong_ullp(elem->data.number, NULL, 10, &elems[i]) < 0) - return -1; - - if (elems[i] > maxelem) - maxelem =3D elems[i]; - } - - *bitmap =3D virBitmapNew(maxelem + 1); - - /* second pass sets the correct bits in the map */ - for (i =3D 0; i < val->data.array.nvalues; i++) - ignore_value(virBitmapSetBit(*bitmap, elems[i])); - - return 0; -} - - virJSONValuePtr virJSONValueNewArrayFromBitmap(virBitmapPtr bitmap) { diff --git a/src/util/virjson.h b/src/util/virjson.h index c22bc1fb45..1f15b23233 100644 --- a/src/util/virjson.h +++ b/src/util/virjson.h @@ -107,8 +107,6 @@ int virJSONValueGetNumberLong(virJSONValuePtr object, l= ong long *value); int virJSONValueGetNumberUlong(virJSONValuePtr object, unsigned long long = *value); int virJSONValueGetNumberDouble(virJSONValuePtr object, double *value); int virJSONValueGetBoolean(virJSONValuePtr object, bool *value); -int virJSONValueGetArrayAsBitmap(const virJSONValue *val, virBitmapPtr *bi= tmap) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); bool virJSONValueIsNull(virJSONValuePtr object); virJSONValuePtr virJSONValueObjectGetObject(virJSONValuePtr object, const char *key); --=20 2.30.2