From nobody Mon Feb 9 03:14:01 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=1601624615; cv=none; d=zohomail.com; s=zohoarc; b=MY3kI8e8PVdXVsCNN7NNVruRkwl6riT4zMLVDs+iDK8F9plPg+F7C6/gQ8XcTxu3MrSXB2Wxw4BTytmsseMynpwL5igl7IChe1Zp7u3zF0ajd0nn1NcKLVI0x3xg2mOtkdC0u0/FwXz9Ljou+w70R9ysdeC3gz2J0WMZuNl3iE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601624615; 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=UhUgj89OZ8Z8GESRSNIDYzoS7smWx6XKFbX3HYKx9lY=; b=GXOpLK9K5OBvM5f7YFzl2XaD1Gt3UM07WIG3FJwiXxYE4p8MbOI1kIeILNn3PgXZ3wrQgRx2w0HgBNmkKRX8a4OKCxkoD6wE1d/LyqXT7ImckpP/zzwJ0S3cSwgmB5NU4fTTrCGd3OeS2gOsqBGK4FHwSSIMc+stpf2OsEAk8Eg= 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 1601624615290772.8710152759279; Fri, 2 Oct 2020 00:43:35 -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-466-1co79bylN86ThlJYrE3hUw-1; Fri, 02 Oct 2020 03:43:29 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 00E46100A8F7; Fri, 2 Oct 2020 07:43:23 +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 A06081992F; Fri, 2 Oct 2020 07:43:21 +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 AD37844A41; Fri, 2 Oct 2020 07:43:18 +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 0927hH6R004099 for ; Fri, 2 Oct 2020 03:43:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4BB1519931; Fri, 2 Oct 2020 07:43:17 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E5991992F for ; Fri, 2 Oct 2020 07:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601624611; 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=UhUgj89OZ8Z8GESRSNIDYzoS7smWx6XKFbX3HYKx9lY=; b=e+sTUb7F51BEq1Hk+sY2q6xiSjbaiRMR5wseL8EY8P7Am4V3g3AYgVgv6tciirSFTpMhr2 xiwMhun2B/H0VNXlV92O+F4LD4TXiBD/3IWA+LiIbMLDFpsNsb6WokRUUQQ7TEcOPWQUnO /ONTY8Ajf9VoNuvLoAIJ7J5YJ8EFbdo= X-MC-Unique: 1co79bylN86ThlJYrE3hUw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/15] virBitmapToString: Remove unused 'prefix' and 'trim' arguments Date: Fri, 2 Oct 2020 09:42:56 +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.23 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" There's only one combination used so we can remove the rest. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virbitmap.c | 15 +-------------- src/util/virbitmap.h | 2 +- src/util/virresctrl.c | 2 +- tests/virbitmaptest.c | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 639103e518..ad5213f216 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -327,17 +327,13 @@ virBitmapGetBit(virBitmapPtr bitmap, /** * virBitmapToString: * @bitmap: Pointer to bitmap - * @prefix: Whether to prepend "0x" - * @trim: Whether to output only the minimum required characters * * Convert @bitmap to printable string. * * Returns pointer to the string or NULL on error. */ char * -virBitmapToString(virBitmapPtr bitmap, - bool prefix, - bool trim) +virBitmapToString(virBitmapPtr bitmap) { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; size_t sz; @@ -345,9 +341,6 @@ virBitmapToString(virBitmapPtr bitmap, size_t diff; char *ret =3D NULL; - if (prefix) - virBufferAddLit(&buf, "0x"); - sz =3D bitmap->map_len; while (sz--) { @@ -360,15 +353,9 @@ virBitmapToString(virBitmapPtr bitmap, if (!ret) return NULL; - if (!trim) - return ret; - if (bitmap->nbits !=3D bitmap->map_len * VIR_BITMAP_BITS_PER_UNIT) { char *tmp =3D ret; - if (prefix) - tmp +=3D 2; - len =3D strlen(tmp); sz =3D VIR_DIV_UP(bitmap->nbits, 4); diff =3D len - sz; diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h index 7f1a109c01..615ec6e4af 100644 --- a/src/util/virbitmap.h +++ b/src/util/virbitmap.h @@ -81,7 +81,7 @@ virBitmapPtr virBitmapNewString(const char *string) ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; -char *virBitmapToString(virBitmapPtr bitmap, bool prefix, bool trim) +char *virBitmapToString(virBitmapPtr bitmap) ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; char *virBitmapFormat(virBitmapPtr bitmap); diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 6de700a645..2d945ff934 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -1592,7 +1592,7 @@ virResctrlAllocFormatCache(virResctrlAllocPtr alloc, if (!mask) continue; - mask_str =3D virBitmapToString(mask, false, true); + mask_str =3D virBitmapToString(mask); if (!mask_str) return -1; diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index 1c7dc1d610..e1a49bfe35 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -681,7 +681,7 @@ test13(const void *opaque G_GNUC_UNUSED) if (!map) goto cleanup; - str =3D virBitmapToString(map, false, true); + str =3D virBitmapToString(map); if (!str) goto cleanup; --=20 2.26.2